RAQ

Getting Highest Price at Zero Hour




Q:

I am trying to use one of the functions that comes with iExpertAdvisor, specifically fnGetLowest or fnGetHighest. I am trying to get the high and low price for 0 hour and use it in a trading strategy. I have configured the function properly but is does not seem to be getting this high and low price right every day. Could you let me know another way to do this or is there something else I need with this function to make it work properly.

A:

I would use the MQL Hour() function to check that the hour is 1, and if so, use the function fnGetHighest to get the highest values between the 0 and 1 bars.  Set the TimeFrame to PERIOD_D1.  This will give you the highest price value between 0 and 1 because it will only execute the function when the Hour is equal to 1. Although the function may be called multiple times, the value will not change because the high has been established for that period.

 

Note the parenthesis after Hour(). Earlier versions of the MetaTrader compiler would compile without the parenthesis, but they are now required.  A new version of VTS being released shortly will ensure the parenthesis are there.

 

Here is short video showing the process:

 


 



To get notified about the latest questions and answers, follow us!