jeff
New Member
Posts: 1
|
Post by jeff on Jul 22, 2019 13:55:10 GMT -5
Hello,
Very glad I found this forum.
I've been coding in Thinkscript for a few years now, but having challenges with something I want to accomplish that will help with back testing.
Unlike real time trading, back testing has the benefit of having future data to rely upon (for the testing).
Here is the challenge I'm having: Once I get an entry trigger, I want to have thinkorswim scan the future bars for the exit trigger, and then compare the entry bar, with the exit bar - but at the point of the entry bar.
If it was always the same distance from the entry bar to the exit bar, it would be simple. For example, if the exit bar was always 23 bars in the future and I wanted the close value of that bar, I could just use close[-23].
But the challenge is - the exit bar distance from the entry bar distance is variable. The exit bar may be 4 bars in the future, or 14, or 26. So, from the entry bar, the code would need to go through each future bar until the exit bar is encountered, then return the required data from this future exit bar to the current entry bar.
I've gotten it to work in reverse, at the exit bar, by using a counter from the entry bar and the getvalue command to get the data from the entry bar. However, being that this is happening at the exit bar location and not at the entry bar location, it's not very useful for the strategy I am using.
Has anyone ever tried something similar, or have any ideas that may work?
Many thanks in advance for any input or ideas, Jeff
|
|