Forex
Google

Go Back   Forex Trading > Discussion Areas > Setup Questions
Forex Forum FAQ Members List Calendar 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

 
 
LinkBack Thread Tools
 
Old 04-07-2006, 05:07 PM
multa's Avatar
multa multa is offline
Junior Member
 
Join Date: Feb 2006
Posts: 18
multa is on a distinguished road
How to find the time of the High and Low ???????

Hello,
I am trying to code an expert. If for example it is 15 o'clock and the daily price on GBPUSD has had a Low at 12:39 and a High at 7:23, how do I find these time values with mql4 ?????????

I have tried:

Code:
t1=TimeHour(iHigh(NULL,PERIOD_D1,0));
t2=TimeHour(iLow(NULL,PERIOD_D1,0));
and so on... but nothing seems to work, can someone please help me out ?????????????????
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 04-07-2006, 07:13 PM
multa's Avatar
multa multa is offline
Junior Member
 
Join Date: Feb 2006
Posts: 18
multa is on a distinguished road
Well I have figured out how to locate the shift from the current bar to the low and high with this code:

Code:
  datetime some_time=Time[0];
  int      shift=iBarShift(NULL,PERIOD_M1,some_time);
  int      ht=Highest(NULL,PERIOD_M1,MODE_HIGH,shift,0);
  int      lt=Lowest(NULL,PERIOD_M1,MODE_LOW,shift,0);
The only problem is that I can only use this on a daily chart, does someone know how I can get it to check the shift on any chart.
I mean getting this to say midnight o'clock 00:00 ??
Code:
datetime some_time=Time[0];
Please make suggestions
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 04-07-2006, 10:13 PM
multa's Avatar
multa multa is offline
Junior Member
 
Join Date: Feb 2006
Posts: 18
multa is on a distinguished road
Got it

I finally got it with some help on another forum

the code is:

Code:
  datetime some_time=iTime(NULL,PERIOD_D1,0);
  int      shift=iBarShift(NULL,PERIOD_M1,some_time);
  int      ht=Highest(NULL,PERIOD_M1,MODE_HIGH,shift,0);
  int      lt=Lowest(NULL,PERIOD_M1,MODE_LOW,shift,0);
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 04-07-2006, 11:18 PM
multa's Avatar
multa multa is offline
Junior Member
 
Join Date: Feb 2006
Posts: 18
multa is on a distinguished road
I have tested my code on a script. And with this code:

Code:
 datetime some_time=iTime(NULL,PERIOD_D1,0);
 int      shift=iBarShift(NULL,PERIOD_M1,some_time);
 int      ht=Time[Highest(NULL,PERIOD_M1,MODE_HIGH,shift,0)];
 int      lt=Time[Lowest(NULL,PERIOD_M1,MODE_LOW,shift,0)];
   string var1=TimeToStr(some_time,TIME_DATE|TIME_SECONDS);
   string var2=TimeToStr(ht,TIME_SECONDS);
   string var3=TimeToStr(lt,TIME_SECONDS);
Comment("high is",var2,"\n","low is",var3,"\n","time",var1);
I only get the right time on the M1 chart.

But with this code:

Code:
 datetime some_time=iTime(NULL,PERIOD_D1,0);
 int      shift=iBarShift(NULL,PERIOD_M1,some_time);
 int      ht=Highest(NULL,PERIOD_M1,MODE_HIGH,shift,0);
 int      lt=Lowest(NULL,PERIOD_M1,MODE_LOW,shift,0);
 Comment("shift of bar with open time ",TimeToStr(some_time)," is ",shift,"\n","high is",ht,"\n","low is",lt);
I get the index value of the shift from the current bar to the high and to the low on all the charts from M1 to MN. Since my purpose is to determine which one the high or the low was first I can use the second code.

But when I use this code in an expert advisor, it won't trade. The only logic I changed was:

Before buy: if (lt>ht) it is ok to buy

before sell: if (ht>lt) it is ok to sell

Does any one know how to do this ??????
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 

Thread Tools

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
Can someone tell me about Super RSI? Where can I find it? carly96 Expert Advisors - Metatrader 4 8 06-11-2007 01:59 PM
Martingale and other high risk high reward systems TraderGeek General Discussion 15 05-03-2007 05:59 AM
High-High/Low-Low indicator trevman Indicators - Metatrader 4 5 01-07-2007 04:39 AM
How to get High[1] on 2 diff charts at the same time knili Metatrader 4 5 09-15-2006 12:52 AM
Where can i find this Charting ? nak71 Tools and utilities 3 08-24-2006 04:56 AM


All times are GMT. The time now is 02:17 AM.