Download MetaTrader 5
To add comments, please log in or register
Have you developed a profitable strategy? Share it with millions of traders via Signals!
kai197
17
kai197 2016.09.12 03:58 

Hi, i'm currently coding a strategy which requires a Fibonacci in a specific time range.

Let say, the Fibonacci levels has to be drawn based on 1 month highest and lowest point.

 

      int fibHigh = iHighest(NULL, PERIOD_W1, MODE_HIGH, *What to put?*, 1);
      int fibLow  = iLowest(NULL, PERIOD_W1,MODE_LOW, *What to put?*, 1);
   

 

I'm using iHighest and iLowest to look out for the highest and lowest tick, but I have no idea what function/value should I put in the count so that the Fibonacci level can be drawn based on the highest and lowest point of that time range?

Please advice, much obliged! 

peter.MT4Web
158
peter.MT4Web 2016.09.12 06:21  

Hi!

We don't know how you define a month.

Is a calender month or just the last 30 days or 4 to 5 weeks and is the actual week included?

Open a W1 chart and define what you want and fill the parameters of your function calls.

Fernando Carreiro
1468
Fernando Carreiro 2016.09.12 07:24  
kai197:

Hi, i'm currently coding a strategy which requires a Fibonacci in a specific time range.

Let say, the Fibonacci levels has to be drawn based on 1 month highest and lowest point.

I'm using iHighest and iLowest to look out for the highest and lowest tick, but I have no idea what function/value should I put in the count so that the Fibonacci level can be drawn based on the highest and lowest point of that time range?

Please advice, much obliged! 

You have to use the function iBarShift() to identify the bar shift positions, from the dates and times you define. With those bar shifts you can then calculate the starting position and bar count to use in iHighest() and iLowest().

See the following post for an example of its use and adapt it to your own requirements: https://www.mql5.com/en/forum/158978

kai197
17
kai197 2016.09.12 07:25  
eddie:

Hi!

We don't know how you define a month.

Is a calender month or just the last 30 days or 4 to 5 weeks and is the actual week included?

By calender month.

 

eddie:

Open a W1 chart and define what you want and fill the parameters of your function calls.

What is the parameters should I put if I want the month to be fixed for the next entire trading month? 

Thank you. 

Fernando Carreiro
1468
Fernando Carreiro 2016.09.12 07:31  
kai197: By calender month.  What is the parameters should I put if I want the month to be fixed for the next entire trading month?

To build the dates, you can use the functions TimeToStruct() and StructToTime() so that you have dates specific to the first day of the each calendar month (or whatever criterion, you want to define), which you can then use with iBarShift() and then apply to iHighest() and iLowest() (see my previous post)

PS! Alternatively, just obtain the date/time for the higher Monthly time-frame bars, using iTime(), in order to more easily synchronise with the Weekly time-frame.

Actually it is way easier, to just use the OHLC values from the Monthly bars, as that already tells you the High and Low for the entire month, so there is no need to get it from the weekly bars.

kai197
17
kai197 2016.09.12 08:18  
FMIC:

To build the dates, you can use the functions TimeToStruct() and StructToTime() so that you have dates specific to the first day of the each calendar month (or whatever criterion, you want to define), which you can then use with iBarShift() and then apply to iHighest() and iLowest() (see my previous post)

PS! Alternatively, just obtain the date/time for the higher Monthly time-frame bars, using iTime(), in order to more easily synchronise with the Weekly time-frame.

Actually it is way easier, to just use the OHLC values from the Monthly bars, as that already tells you the High and Low for the entire month, so there is no need to get it from the weekly bars.

Thks for ur valuable advice!

Let me try first~ 

/
To add comments, please log in or register