Hi!
I have written EA using 2 strategy. first strategy i use 30 minutes and 2nd strategy i use 4hrs and for JPY pairs.
I run EA with 30min tf. for second strategy i used BB indicator at 4hr timeframe and once per bar.
I validate the below conditions once per bar. problom is EA check every 30 minute candle, bcoz i run ea by 30m timeframe. how to make this ea to run second strategy with 4hr timeframe. please give me support.
Hi!
I have written EA using 2 strategy. first strategy i use 30 minutes and 2nd strategy i use 4hrs and for JPY pairs.
I run EA with 30min tf. for second strategy i used BB indicator at 4hr timeframe and once per bar.
I validate the below conditions once per bar. problom is EA check every 30 minute candle, bcoz i run ea by 30m timeframe. how to make this ea to run second strategy with 4hr timeframe. please give me support.
if (Close[2] > iBands(NULL, PERIOD_H4,20,2.0,0,PRICE_CLOSE,MODE_UPPER,2))
Close[2] is a value from your 30M chart
do you want that value or is it you needed a value from bar2 H4 chart to compare ??
if you check first the time candle 0 H4 and you check newbar according to that candletime ....
Hi!
I have written EA using 2 strategy. first strategy i use 30 minutes and 2nd strategy i use 4hrs and for JPY pairs.
I run EA with 30min tf. for second strategy i used BB indicator at 4hr timeframe and once per bar.
I validate the below conditions once per bar. problom is EA check every 30 minute candle, bcoz i run ea by 30m timeframe. how to make this ea to run second strategy with 4hr timeframe. please give me support.
datetime Bartime; if (BarTime < Time[0]) { // we have a new bar opened BarTime = Time[0]; // keep the new bar open time }
Close[2] is a value from your 30M chart
do you want that value or is it you needed a value from bar2 H4 chart to compare ??
if you check first the time candle 0 H4 and you check newbar according to that candletime ....
How do you do this ? do the same but for the H4 timeframe . . .
datetime Bartime; if (BarTime < Time[0]) { // we have a new bar opened BarTime = Time[0]; // keep the new bar open time }
So if you want your condition about H4 to be run only once per H4 bar, you have to use anothor method. What you post here only detect a new bar on current chart. Use iTime() instead of Time[].
datetime Bartime; if (BarTime < Time[0]){ BarTime = Time[0]; // keep the new bar open time : }Won't work. as Bartime will ALWAYS be zero. Code runs every tick. Search once per bar and learn the difference.
So if you want your condition about H4 to be run only once per H4 bar, you have to use anothor method. What you post here only detect a new bar on current chart. Use iTime() instead of Time[].
Changed code changing iTime(). works fine now.
Thanks for your support angevoyageur,RaptorUK,WHRoeder
datetime Bartime; if (BarTime < iTime(NULL,PERIOD_H4,0)) { // we have a new bar opened BarTime = iTime(NULL,PERIOD_H4,0); // keep the new bar open time } if (iClose(NULL,PERID_H4,2) > iBands(NULL, PERIOD_H4,20,2.0,0,PRICE_CLOSE,MODE_UPPER,2))
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi!
I have written EA using 2 strategy. first strategy i use 30 minutes and 2nd strategy i use 4hrs and for JPY pairs.
I run EA with 30min tf. for second strategy i used BB indicator at 4hr timeframe and once per bar.
I validate the below conditions once per bar. problom is EA check every 30 minute candle, bcoz i run ea by 30m timeframe. how to make this ea to run second strategy with 4hr timeframe. please give me support.