Jump to content
Medved Trader Forums

How to access high of the day for comparisons?

Recommended Posts

I am trying to write paintbar code for a scan which would alert given conditions such as the high of the day is equal to the high of the first 5 minute candlestick in the chart or that the low of the day was reached by the previous candlestick, etc.. How would I accomplish this? I am assuming I would need state keeping to do this since the high/low of the day would need to be retained for each new paintbar calculation but I have tried using CurrentState and SymbolData as a test without any success. Is there a better way?


Link to comment
Share on other sites

SymbolData.High and SymbolData.Low is high or low of the day. The first 5 minute high/low is something that you would need to calculate yourself - basically make the variables in the advanced code (outside the functions) that would hold the high/low, then in the code check if current timestamp is within first five minutes of the session and set the high/lows accordingly...

If that is not clear I could post some code here for you.

Link to comment
Share on other sites

Okay, just to begin with a simple test case I tried:


public void MainCalculation() { if (High == SymbolData.High) { SetColor("High", SysColor.MainIndicator3); return; } }

on a 5 minute chart but it doesn't highlight the candlestick with the high. I suspect there's something about the how it's calculated that I don't understand. According to this I'm expecting that the paintbar will iterate through each candlestick in the chart in sequence comparing the high of that candlestick to the high of the day.

Edited by Jason
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...