According to iBarShift documentation:
exact=false [in] A return value, in case the bar with the specified time is not found. If exact=false, iBarShift returns the index of the nearest bar, the Open time of which is less than the specified time (time_open<time). If such a bar is not found (history before the specified time is not available), then the function returns -1. If exact=true, iBarShift does not search for a nearest bar but immediately returns -1. |
---|
Write down the expected values from FxSession[i][pID].Begin, iBarShift, iHighest and iHigh somewhere. Print all these values into a log and compare them to the expected values. This way you localize the problem.
In the meantime, this looks like a question for psychics.
Another thread with the same issue in OOP class https://www.mql5.com/en/forum/467428
Now today I am trying to run an indicator where Highest values are calculated and I am getting price much lower than the Highest price.
I have used the indicator earlier, with the correct results.
Just trying to reconfirm, if there is new bug/change in the MQL function as it is happening at two different codes.
regards.
double price1 = iHigh(gSymbol,PERIOD_H1,iHighest(gSymbol,_Period,MODE_HIGH,28,iBarShift(gSymbol,_Period,FxSession[i][pID].Begin,false)));
You find the bar index on the current timeframe, and call iHigh for H1, passing the bar index from the current timeframe
You find the bar index on the current timeframe, and call iHigh for H1, passing the bar index from the current timeframe
Thank you everyone for your time to reply.
@Vladislav Boyko you caught the right problem. I did change PERIOD_H1 to _Period in iHighest() but forgot to change the same in iHigh(). Seems I needed a break :)
Can you please look into another thread also, seems I must have made some silly mistake which I am not able to trace.
THANKS A LOT.
You only copied the price.. the index has changed on truncated price data after the copy
Is your reply relates to earlier thread at https://www.mql5.com/en/forum/467428?
If true, please elaborate what did you mean in the same thread, instead of here.
Thanks a lot
- 2024.05.23
- Anil Varma
- www.mql5.com
Is your reply relates to earlier thread at https://www.mql5.com/en/forum/467428?
If true, please elaborate what did you mean in the same thread, instead of here.
Thanks a lot
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Another thread with the same issue in OOP class https://www.mql5.com/en/forum/467428
Now today I am trying to run an indicator where Highest values are calculated and I am getting price much lower than the Highest price.
I have used the indicator earlier, with the correct results.
Just trying to reconfirm, if there is new bug/change in the MQL function as it is happening at two different codes.
regards.