Forex
Google

Go Back   Forex Trading > Metatrader Training > Metatrader 4 mql 4 - Development course > Questions
Forex Forum Register FAQ Members List Calendar Search Today's Posts Mark Forums Read


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

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-15-2005, 12:20 AM
Vasilyt Vasilyt is offline
Junior Member
 
Join Date: Dec 2005
Posts: 15
Vasilyt is on a distinguished road
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;
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 12-15-2005, 12:53 PM
codersguru's Avatar
codersguru codersguru is offline
Senior Member
 
Join Date: Oct 2005
Posts: 987
codersguru has a spectacular aura aboutcodersguru has a spectacular aura aboutcodersguru has a spectacular aura about
Exclamation Session2

Vasilyt,
Please try attached indicator and tell me what do you think?
Attached Files
File Type: mq4 Session2.mq4 (2.6 KB, 47 views)
__________________
Hope it helps !
Coders' Guru
Senior MQL programmer:
www.xpworx.com/custom.htm
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 12-15-2005, 11:19 PM
Vasilyt Vasilyt is offline
Junior Member
 
Join Date: Dec 2005
Posts: 15
Vasilyt is on a distinguished road
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?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


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


All times are GMT. The time now is 10:42 AM.