Forex



Go Back   Forex Trading > Training > Metatrader > Metatrader 4 mql 4 - Development course > Questions
Forex Forum Register More recent Calendar Advertising Others Help






Register
Welcome to Forex-TSD!, one of the largest Forex forums worldwide, where you will be able to find the most complete and reliable Forex information imaginable.

From the list below, select the forum that you want to visit and register to post, as many times you want. It’s absolutely free. Click here for registering on Forex-TSD.

Exclusive Forum
The Exclusive Forum is the only paid section. Once you subscribe, you will get free access to real cutting-edge Trading Systems (automated and not), Indicators, Signals, Articles, etc., that will help and guide you, in ways that you could only imagine, with your Forex trading.
  • Elite Section
    Get access to private discussions, specialized support, indicators and trading systems reported every week.
  • Advanced Elite Section
    For professional traders, trading system developers and any other member who may need to use and/or convert, the most cutting-edge exclusive indicators and trading systems for MT4 and MT5.
See more

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 12-15-2005, 01:20 AM
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!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #2 (permalink)  
Old 12-15-2005, 01:53 PM
codersguru's Avatar
Senior Member
 
Join Date: Oct 2005
Posts: 994
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, 60 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!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #3 (permalink)  
Old 12-16-2005, 12:19 AM
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!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Indicator needed to plot high/lows et_phonehome_2 Tools and utilities 7 05-02-2009 01:34 PM
let's remake this 123 indicator with sound alert & fibonacci zone.. bijak_sinner Indicators - Metatrader 4 7 10-18-2006 03:13 AM
MQLII to MQL4 conversion and vice versa! codersguru Suggestions for Trading Systems 18 06-02-2006 05:07 PM


All times are GMT. The time now is 06:02 PM.



Search Engine Friendly URLs by vBSEO 3.2.0 ©2008, Crawlability, Inc.