3acor Posted January 17, 2021 Report Share Posted January 17, 2021 Hey, I want to say for example: If 1st candle Close after opening range high is .... or another example If Close (at 10am) is ..... Is it possible to do so? Quote Link to comment Share on other sites More sharing options...
Jerry Medved Posted January 17, 2021 Report Share Posted January 17, 2021 Not directly, no. to do that you would have to use the advanced mode and add State Keeping Code (VIEW tab has option for that). and then save the reference to the candle you want to reference. And also clear that at start of day. Keep in mind that the code operates on one candle at a time and is called for every candle 1 Quote Link to comment Share on other sites More sharing options...
3acor Posted January 17, 2021 Author Report Share Posted January 17, 2021 (edited) Is there a way to include duration? I want for example: If SymbolData.Last < VWAP for 2hours. I see it is something that might be done with the Looping functions. Will try it Edited January 17, 2021 by 3acor Quote Link to comment Share on other sites More sharing options...
Mike Medved Posted January 18, 2021 Report Share Posted January 18, 2021 Well that depends on what the frequency of the candle is (that is, 2 hours with 1 min candles would be 120 candles, but with 5 min candles obviously would be 24). Looping functions going back 100 would work but not be efficient. It could be done by using a state counter - each time Last<VWAP would increase the counter, and each time Last>=VWAP it would zero out the counter. When the counter reaches 120 (for 1-min candles).. bingo. Or of course instead of the counter you could use the timestamp of the candle and compare the diff. between now-candle and the first candle where Last<VWAP. That would work with non-time-based candles, but would create a problem when the two-hour period crosses the session boundary, though. 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.