getting the candle id for previous day high and low
-
hello everyone
can somebody please suggest a way to get the candle id of the previous day high and low (not the price , but the candle id)?for example take the a look at the image below , the timeframe is m15 , and i want to get the candle id of the candles that are the highest and lowest during that day

-
this?



-
@miro1360 i cant believe i never noticed it before ......thanks miro
-
@miro1360 another question please ...... what would be the best way to get the candle id where an indicator had made the highest point during a day ?
-
again the same technique, but with "My Indicators" option, because it has much more settings

indicators can be downloaded here:
https://www.mql5.com/en/code/mt4/indicators/page57 -
But there is no option to get Candle ID
anyway, you can always do a loop

-
@miro1360 well loops on their own are not a problem i have finally got a grasp on the loops a little bit , but how can we restrict the loop to run between a specific period ?
i mean how to make the loops avoid all of "today's candles" and only take all of yesterdays candles into consideration

-
@miro1360 Whats your opinion on the ArrayMaximum() function ?
if i understood it correctly , this function it returns the index of the highest array value ? if i store the all the values of indicator during the specified period of time (previous day in this case) and then use the index of the highest value as the candle id ? do you think it could work ? -
the custom code can help you ("for" is the loop, "break" ends the loop before it comes to an end)
iMA is the indicator, it can be any, even a custom
https://docs.mql4.com/indicators/ima
you can recreate it into blocks, or use it as is
https://fxdreema.com/shared/ye5WVCBpbworking with time in mql is sometimes tricky
if you don't understand some variables, you can easily print them on the screen with the comment block (debugging :D)

-
@miro1360 amazing just amazing!!!!!
no amount of words can express my appreciation and gratitude , you are an absolute gem , all i can say is thank you miro , THANK YOU! -
Hi @miro1360
I am trying to use this to find candle ID for another indicators (MACD in this case).
Basically I would like to find candle ID with the highest MACD value or lowest MACD value.
However, I am kinda failed.Can you help?
How to find candle ID within evaluation period of the highest MACD value or lowest MACD value.