- You change TF and still get a cross? You should only be looking at bar 2/1 for the alert. Fix your broken code.
- Don't alert on first run (prev_calculated is zero.)
- Or use persistent storage such as Global Variables of the
Terminal to restore your static variable on init.
- You change TF and still get a cross? You should only be looking at bar 2/1 for the alert. Fix your broken code.
- Don't alert on first run (prev_calculated is zero.)
- Or use persistent storage such as Global Variables of the
Terminal to restore your static variable on init.
I'm only looking at bar 2/1 for the alert.
oh and forgot to tell I'm on mql4.
can you explain what you mean with prev_calculated is zero?
I tried to save it in a library cause I found that here somewhere but that doesnt work either
Bockwurst14:
oh and forgot to tell I'm on mql4.
-
Why did you post your MT4 question in the
Root /
MT5 General section
instead of the
MQL4 section, (bottom of the Root page?)
General rules and best pratices of the Forum. - General - MQL5 programming forum
Next time post in the correct place. The moderators will likely move this thread there soon. - How do you decide what bars to compute? You should stop using the old IndicatorCounted and start using the new Event Handling Functions - Functions - Language Basics - MQL4 Reference
-
Why did you post your MT4 question in the
Root /
MT5 General section
instead of the
MQL4 section, (bottom of the Root page?)
General rules and best pratices of the Forum. - General - MQL5 programming forum
Next time post in the correct place. The moderators will likely move this thread there soon. - How do you decide what bars to compute? You should stop using the old IndicatorCounted and start using the new Event Handling Functions - Functions - Language Basics - MQL4 Reference
Completly forgot to check :D
I just had an idea, that the problem might be that I use Time[0] to check if the alert was allready sent for the current bar.
Because if I switch the timeframe, Time[0] contains the opening Time of a bar of a different timeframe right?
So how can I do that differently?
Completly forgot to check :D
I just had an idea, that the problem might be that I use Time[0] to check if the alert was allready sent for the current bar.
Because if I switch the timeframe, Time[0] contains the opening Time of a bar of a different timeframe right?
So how can I do that differently?
how did you take care of this issue? , i am having the same problem with time[0]

- 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,
so as I wrote in the title, I coded an Indicator that gives me an alert when the last candle crossed the 21 Ema. I also check, if the alert was allready send on that candle by saving and then checking the value Time[0].
Now when I get an alert and change the timeframe on that chart, I get the same alert again. I guess thats because the Indicator gets loaded again.
does anyone know how to stop the indicator from sending the alert again, when i change the timeframe?