|
|||||||
| 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 |
|
|
||||
|
||||
|
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); I mean getting this to say midnight o'clock 00:00 ?? Code:
datetime some_time=Time[0]; ![]() |
|
|
||||
|
||||
|
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); ![]() |
|
|
||||
|
||||
|
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);
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);
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 ?????? |
| Thread Tools | |
|
|
|
|
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 |