How do you know the conditions are never true?
Once the object "Buy" has been created, another object with the same name cannot be created again
Either check that the object exists already and if so, move it.
Or give each object a unique name, such as
double close = Close[1]; //The price from earlier in your code datetime time = iTime(NULL,0,1); //The time from earlier in your code string ob_name="Buy "+TimeToStr(time); if(ObjectFind(0,ob_name)<0) ObjectCreate(ob_name,OBJ_ARROW_THUMB_UP,0,time,close);
Unrelated to your question. When comparing values from any indicator from different timeframes, you need to be sure that you are comparing the bars that you want to.
with your code, say the current time is 05:12
At that time Bar[1] on the M5 chart is the bar that opened at 05:05
on M15, Bar[1] opened at 04:45.
How do you know the conditions are never true?
Once the object "Buy" has been created, another object with the same name cannot be created again
Either check that the object exists already and if so, move it.
Or give each object a unique name, such as
Unrelated to your question. When comparing values from any indicator from different timeframes, you need to be sure that you are comparing the bars that you want to.
with your code, say the current time is 05:12
At that time Bar[1] on the M5 chart is the bar that opened at 05:05
on M15, Bar[1] opened at 04:45.
Thanks for the code GumRai that will be useful
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I am trying to run a test on the MT4 strategy tester on the 5m chart. I want conditions to be met on both the 5m and 30m charts.
It appears to ignore the 30m chart condition so the condition is never true?
I basically dont know how to make a condition true on a bigger timeframe apply to a smaller timeframe?