tonyjms2005:
You cold certainly improve the readability of your code . . . . ds, dr, wt, wsti . . . what do these variables stand for ? why not give them meaningful names that don't have to be guessed at ? I also find your braces layout hard to follow . . . I have my own style that I am used to but I don't see much consistency in what you have done, for example the last line that starts, if(t>Global . . . I can't quickly see which block of code it belongs to.
Hello
I haven an EA that runs 24 hours a day and takes into account the 3 main timezone session.
Here is what I usE to identify the current time zone and so it is then used to find the start bar of the session:
Is there a way to do this thats uses more efficient coding?
Bearing in mind I still quite a novice so examples would be useful
Hi
Thanks for the reply, I have reattached the "cleared up" version of the code:
extern int London_ST = 8;// 7 FOR SUMMER extern int London_ET = 17;// 16 FOR SUMMER extern int NewYork_ST = 13;// 12 FOR SUMMER extern int Asia_ST = 22;//21 FOR SUMMER extern int Asia_ET = 9;//8 FOR SUMMER //+------------------------------------------------------------------+ int Brokentime(){ if(DayOfWeek()==0){ daystarttime= iTime(Symbol(),PERIOD_D1,1)+(Asia_ET*3600); } //+------------------------------------------------------------------+ if(DayOfWeek()==1){ if(TimeHour(TimeCurrent())>=0 && TimeHour(TimeCurrent())<London_ST){ daystarttime = iTime(Symbol(),PERIOD_D1,2)+(Asia_ET*3600); } if(TimeHour(TimeCurrent())>=London_ST && TimeHour(TimeCurrent())<Asia_ET){ daystarttime = iTime(Symbol(),PERIOD_D1,2)+(Asia_ET*3600); } if(TimeHour(TimeCurrent())>=Asia_ET && TimeHour(TimeCurrent())<NewYork_ST){ daystarttime = iTime(Symbol(),PERIOD_D1,2)+(London_ET*3600); } if(TimeHour(TimeCurrent())>=NewYork_ST && TimeHour(TimeCurrent())<London_ET){ daystarttime = iTime(Symbol(),PERIOD_D1,2)+((Asia_ST-1)*3600); } if(TimeHour(TimeCurrent())>=London_ET && TimeHour(TimeCurrent())<Asia_ST){ daystarttime = iTime(Symbol(),PERIOD_D1,2)+((Asia_ST-1)*3600); } if(TimeHour(TimeCurrent())>=Asia_ST){ daystarttime = iTime(Symbol(),PERIOD_D1,0)+(Asia_ET*3600); } } //+------------------------------------------------------------------+ if(DayOfWeek()>=2){ if(TimeHour(TimeCurrent())>=0 && TimeHour(TimeCurrent())<London_ST){ daystarttime = iTime(Symbol(),PERIOD_D1,1)+(Asia_ET*3600); } if(TimeHour(TimeCurrent())>=London_ST && TimeHour(TimeCurrent())<Asia_ET){ daystarttime = iTime(Symbol(),PERIOD_D1,1)+(London_ET*3600); } if(TimeHour(TimeCurrent())>=Asia_ET && TimeHour(TimeCurrent())<NewYork_ST){ daystarttime = iTime(Symbol(),PERIOD_D1,1)+(London_ET*3600); } if(TimeHour(TimeCurrent())>=NewYork_ST && TimeHour(TimeCurrent())<London_ET){ daystarttime = iTime(Symbol(),PERIOD_D1,1)+(Asia_ST*3600); } if(TimeHour(TimeCurrent())>=London_ET && TimeHour(TimeCurrent())<Asia_ST){ daystarttime = iTime(Symbol(),PERIOD_D1,1)+(Asia_ST*3600); } if(TimeHour(TimeCurrent())>=Asia_ST){ daystarttime = iTime(Symbol(),PERIOD_D1,0)+(Asia_ET*3600);} } }
Thanks again
Antony
tonyjms2005:
Thank you for making the effort, I think it is much easier to read now :-)
Hi
Thanks for the reply, I have reattached the "cleared up" version of the code:
No problem, I was thinking of using arrays?
I prefer Whitesmith style
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello
I haven an EA that runs 24 hours a day and takes into account the 3 main timezone session.
Here is what I usE to identify the current time zone and so it is then used to find the start bar of the session:
Is there a way to do this thats uses more efficient coding?
Bearing in mind I still quite a novice so examples would be useful
Thanks
Antony