|
|||||||
| Register in Forex TSD! | |
|
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time). Click here to register and get more information |
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
MQLII code to MQL4 - Need to remake indicator that shows sessions and dayhigh/lows
Dear MQL4 experts,
Please help me convert the indicator below to MQL4. Code:
/*[[ Name := Session2 Author := Copyright © 2004, MetaQuotes Software Corp. Link := http://www.metaquotes.net/ Separate Window := No First Color := Blue First Draw Type := Symbol First Symbol := 167 Use Second Data := Yes Second Color := Red Second Draw Type := Symbol Second Symbol := 167 ]]*/ Variable :shift(0),Ctime(0),ho(0),mi(0),i(0), count(0),val1(0), val2(0); Input:periods(3000); SetLoopCount(0); // loop from first bar to current bar (with shift=0) For shift=periods Downto 0 Begin ho=TimeHour(T[shift]); mi=TimeMinute(t[shift]); if Period = 1.0 then { Ctime=Ho*60+mi; } else // 5 if Period = 5.0 then { Ctime=Ho*12+ceil((mi+5)/5); } else // 15 if Period = 15.0 then { Ctime=Ho*4+ceil((Mi+15)/15); } else // 30 if Period = 30.0 then { Ctime=Ho*2+ceil((Mi+30)/30); } else // if Period = 60.0 then { exit; } else // 4 if Period = 240.0 then { exit; } if Ctime = 0 then Ctime = 1; val1=0; val2=0; if (ho>=9 and ho<=13) then { val1=H[Highest(MODE_HIGH,shift+Ctime-1,Ctime)]; val2=L[Lowest(MODE_LOW,shift+Ctime-1,Ctime)]; } if (ho>=15 and ho<=17) then { val2=H[Highest(MODE_HIGH,shift+Ctime-1,Ctime)]; val1=L[Lowest(MODE_LOW,shift+Ctime-1,Ctime)]; } SetIndexValue(shift, val1); SetIndexValue2(shift, val2); Comment("Daly Price Channel= ", (val1 - val2)/Point ); End; |
|
|||
|
Thank you
Thank you very much but unfortunately it doesnt dispay day's highs and lows correctly. Cann't figure out where the mistake is. The code appears to be identical to the origional; so why doesnt it display progressive highs and lows of the day correctly?
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Indicator needed to plot high/lows | et_phonehome_2 | Tools and utilities | 6 | 02-24-2007 04:56 PM |
| let's remake this 123 indicator with sound alert & fibonacci zone.. | bijak_sinner | Indicators - Metatrader 4 | 7 | 10-18-2006 02:13 AM |
| MQLII to MQL4 conversion and vice versa! | codersguru | Suggestions for Trading Systems | 18 | 06-02-2006 04:07 PM |