Jump to content
Medved Trader Forums

How to refer a to candle timestamp

Recommended Posts

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

  • Thanks 1
Link to comment
Share on other sites

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.

  • Thanks 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...