Support Board
Date/Time: Wed, 15 Jan 2025 09:58:30 +0000
USER DISCUSSION: PLEASE HELP A COMPUTER RETARD TRANSLATE SIX LINES OF TRADESTATION CODE
View Count: 1264
[2017-06-19 13:54:17] |
michelh - Posts: 159 |
Hi All, So this is quite embarrassing. I was reading an Ehlers article on a simple method of detrending. Since I want to learn about cycles, I thought it would be good to see what my detended data sets look like. To find the document, please put the following into google "ehlers the joy of detrending" - it is the first result. It looked really interesting and he goes further to make a trend-ambivalent AO - but I am just interested in the first detrend bit. The six lines of tradestation code for the detrender are: Inputs: Price((H+L)/2); Vars: Detrend(0); Value1 = Price + .088*Value1[6]; Value2 = Value1 – Value1[6] + 1.2*Value2[6] - .7*Value2[12]; Detrend = Value2[12] – 2*Value2[6] + Value2; Plot1(Detrend, “Detrend”); I have studied the ASCIL documentation and found the courage to try this. The compiler error I get is: error: stray '\226' in program Det[sc.Index] = V2[sc.Index - 12] – (2 * V2[sc.Index - 6]) + V2[sc.Index]; ^ detrend.cpp: In function 'void scsf_EhlersDetrend(SCStudyInterfaceRef)': detrend.cpp:42:59: error: expression cannot be used as a function Det[sc.Index] = V2[sc.Index - 12] – (2 * V2[sc.Index - 6]) + V2[sc.Index]; If you have ten minutes to spare and can spot my error, that would be appreciated. -------------------------------------------------------------- #include "sierrachart.h" // This line is required. Change the text within the quote // marks to what you want to name your group of custom studies. SCDLLName("EhlersDetrend") //From Stocks & Commodities V. 18:7 (20-29): Optimal Detrending by John F. Ehlers SCSFExport scsf_EhlersDetrend(SCStudyInterfaceRef sc) { // Set the configuration variables SCSubgraphRef Det = sc.Subgraph[0]; SCFloatArrayRef V1 = Det.Arrays[0]; SCFloatArrayRef V2 = Det.Arrays[1]; SCInputRef InputData = sc.Input[0]; if (sc.SetDefaults) { sc.GraphName = "EhlersDetrend"; sc.StudyDescription = "Ehlers Detrend"; sc.AutoLoop = 1; // true // During development set this flag to 1, so the DLL can be rebuilt without restarting Sierra Chart. When development is completed, set it to 0 to improve performance. sc.FreeDLL = 1; sc.GraphRegion = 0; InputData.Name = "Input Data"; InputData.SetInputDataIndex(SC_HL); Det.Name = "Detrend"; Det.DrawStyle = DRAWSTYLE_LINE; // Look in scconstants.h for other draw styles Det.PrimaryColor = RGB(0, 128, 0); // Green Det.SecondaryColor = RGB(255,0,0); Det.LineWidth = 3; return; } V1[sc.Index] = sc.BaseDataIn[SC_HL][sc.Index] + (.088 * V1[sc.Index - 6]); V2[sc.Index] = V1[sc.Index] - V1[sc.Index - 6] + V2[sc.Index - 6] - (0.7 * V2[sc.Index - 12]); Det[sc.Index] = V2[sc.Index - 12] – (2 * V2[sc.Index - 6]) + V2[sc.Index]; return; } Thanks! |
detrend.cpp - Attached On 2017-06-19 13:50:37 UTC - Size: 1.45 KB - 411 views |
[2017-06-19 14:29:36] |
mkata - Posts: 103 |
error: stray '\226' in program means that in your final line one of your minus signs is a hyphen. Re-type those as minus signs and recompile. Also, you don't need the final return (although it does no harm). |
[2017-06-19 14:38:17] |
michelh - Posts: 159 |
thanks. It would have taken me years years to figure that out. stackoverflow.com was talking about how I was using a variable and function with the same name but I did't call any functions so their explanations had me quite confused.
|
[2017-06-19 15:03:18] |
Sierra Chart Engineering - Posts: 104368 |
It was not obvious to us what the problem was either. The compiler error is really not clear. We are not even sure what is meant by " stray". This is not something we see with Visual C++. Would be best to consult the GCC C++ compiler reference for this. Sierra Chart Support - Engineering Level Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy: https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service: Sierra Chart Teton Futures Order Routing Date Time Of Last Edit: 2017-06-19 15:04:02
|
To post a message in this thread, you need to log in with your Sierra Chart account: