Highest and lowest priced candle not working on Mondays
-
A part of my project tries to find the extremes from the day prior (high and low candles and the time) - I appear to be having issues on Mondays though, after the weekend. I'm wondering if this is a broker related issue or EA. This is a snip from today, where my EA found that the high and low (M15 data) happened at the same time, which is incorrect. Here is the code that calculates the variables.
So from this we can see that the day prior is the 13th, which is correct. There are no weekend days being looked at here. However, we know that the high and low of the day did not happen at the same time (M15 chart). Any suggestions on how to implement this differently so that it works?


-
You selected 'time period' option for those highest/lowest values. You should use price level option instead.
-
I am looking to get the time value for the highest and lowest M15 candles between 01:00 and 23:00, not price.
-
Time? Why would you need time? Aren't you looking for the support/resistance for a period?
-
I look for price violations based on yesterday's price action. So, I need to look back and see if there was a violation and have to determine if it was a violation high or low or both. In the case where its a double violation I need a way to determine the last violation, so I find the high and low time of yesterday and compare which one happened first, thereby giving me the violation that happened last. This tells my EA to either look for longs or shorts. In the case of Mondays... The EA is seemingly confused because it tells me that the high and low happened at the same time (M15 candles) which is not what's happening.
-
But I find it is a weird way to consider the market. If I understand correctly what you mean you are looking at those 'violations' and if one happened at 08:35 and the other one at 10:06, for example. What is that telling about the market exactly? I don't see the logic behind that.
-
There's logic, trust me. Lots of data to suggest a correlation between violations and market behavior after... Knowing the time is important because I want to know if the violation was to the upside or downside when I do a lookback. So, Yesterday, was it a high or low violation - the only way I've found to do that is by finding the high and low candle time and seeing which candle violated (time-wise) first or last...
-
Ok. So let's move back to your question. If I understand it correctly you need the exact moment (hour and minute) a high or a low in the past (ie a past candle) happened. Then the bot can know which one happened before the other. Is that correct?
-
I switched from using the time to using candle ID and I'm still experiencing the same problem. Here's a screen shot of the issue right now. My EA is looking back 1 day to find the high and low time and candle ID. On the M15 chart, it's telling me the high from yesterday is 127 candles away from current price. This is an M15 chart, so 127 M15 candles is 31 hours ago. Looking at EURUSD, we can see that the low was really only a few hours ago. I don't understand, it's almost like the EA is looking back too far to two days ago, instead of just 1...

Code that calculates both the time and candle ID for the low/high

-
Illustrating the point even further is that I just added the current server and GMT time to the live chart. Currently it's October 25th, but it's telling me that the high and low for yesterday occurred on October 23rd?

-
@roar Any chance you've encoutered this before?
-
@cmuphyfx Currently the time functions seem to have some bugs. But you can employ some mql5 functions to do the same stuff.
-
@roar This is very helpful, thank you! Is there a way to constrain it to yesterday only, I shifted the timeframe by 1, and the daystart is correct but it still seems to be returning the high/low for today. I don't see a parameter to bound the end time?
-
Update - was able to make it work by utilizing the count and start positions fir iLowest and iHighest with the start index as today.
Thank you for the help!
