Reza nasimi:
Hi
I want to have an alert when the volume is going upper than the volume of 2 min before.
the problem is it makes several alerts because after the first alert , condition will steal true until the next bar starts.
how can I solve this problem?
sorry for poor english
Hi,
You need to save last alert, and refresh it back at new bar.
1. Create variable lastbar as datetime, and alert_done as bool
datetime lastbar; bool alert_done=false;
2. In the main loop
//--check once at every new bar if(lastbar!=Time[0]) { //--do something ... alert_done = false; //-- lastbar=Time[0]; }//-- end lastbar long Prev_Vol=iVolume(NULL,PERIOD_M1,2); long This_Vol=iVolume(NULL,PERIOD_M1,0); //--your running volume now if(!alert_done && This_Vol>Prev_Vol) //--you will get alert just once, until new bar to come { Alert("Alert"); alert_done=true; }
Good luck (^̮^)
Yohana Parmi:
Hi,
You need to save last alert, and refresh it back at new bar.
1. Create variable lastbar as datetime, and alert_done as bool
2. In the main loop
Good luck (^̮^)
Thank you very much dear yohana :)
if(lastbar!=Time[0])
Yohana Parmi's method will alert once per bar, but the alert is based on the M1. If they aren't the same TF, that may not be what you want.if( This_Vol>Prev_Vol) { Alert("Alert");}
You are looking at a signal. You can alert on a change of signal.
Too many orders - MQL4 and MetaTrader 4 - MQL4 programming forum
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
Hi
I want to have an alert when the volume is going upper than the volume of 2 min before.
the problem is it makes several alerts because after the first alert , condition will steal true until the next bar starts.
how can I solve this problem?
sorry for poor english