I have converted one of my TradeStation indicators - Advanced Moving Average into Sierra Charts. I coded everything up and compiled the study. When I applied it to the chart it did not match the TradeStation chart.
After loading Microsoft Visual C ++ Express Edition so I could debug the code (that is what Sierra Chart recommends) then trying to figure out how to use the debugger (I would not say I figured it out - but got it to give me the information I wanted) I still did not get the displays to match. At this point I went into brute force mode and starting breaking the individual components out and plotting them. This approach led me to the answer. Here is where I messed up ...
In Tradestation I can use Close[5] to give me the data for the Close 5 bars back. So in Sierra Chart ACSIL I did this
sc.BaseDataIn[SC_HIGH][Value5] where Value5 was the number of bars back I wanted the High. Well - that just reference the High value that was stored in the array in position Value5. Now if one looks at the documentation one would realize that. However, I am so accustom to TradeStation Easy Language syntax that I could not "see" the error. Of course the code compiled ok so... after several hours and the brute force approach I realized I needed to write the formula as
sc.BaseDataIn[SC_HIGH][sc.Index-Value5]
instead. When I did that everything worked just like it was supposed to. It appears I have to use the sc.Index on anything that is an array.
I am going in search of how to define color as an input variable.
Thursday, April 8, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment