![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
I have coded a custom indicator based on Ichimoku and added an alert for buy and/or sell conditions. However the alert loops nonstop. Can someone help me on anything I have missed.
if(IsStopped())
return(0);
for(int i=startBar; i<rates_total && !IsStopped();i++)
{
ExtChikouBuffer[i] = EMPTY_VALUE;
}
buycondition = (ExtTenkanBuffer[i]>ExtKijunBuffer[i] && Bid>ExtTenkanBuffer[i]);
sellcondition = (ExtTenkanBuffer[i]<ExtKijunBuffer[i] && Ask<ExtTenkanBuffer[i] );
}
if(buycondition)
{ if (EnableNativeAlerts) Alert("BUY");
if (EnableSoundAlerts) PlaySound(SoundFileName);
LastAlertTime=iTime(Symbol(),Period(),3);
LastAlertDirection = 1;
}else
if (sellcondition)
{ if (EnableNativeAlerts) Alert("SELL");
if (EnableSoundAlerts) PlaySound(SoundFileName);
LastAlertTime=iTime(Symbol(),Period(),3);
LastAlertDirection =-1;
}
//--- return value of prev_calculated for next call
return(rates_total);
}
I have coded a custom indicator based on Ichimoku and added an alert for buy and/or sell conditions. However the alert loops nonstop. Can someone help me on anything I have missed.
Please edit your post and
use the code button (Alt+S) when pasting code
Please edit your (original) post and use the CODE button (Alt-S)! (For large amounts of code, attach it.)
General rules and best pratices of the Forum. - General - MQL5 programming forum 2019.05.06
Messages Editor
Don't Hijack other threads for your off-topic post. Next time, make your own, new, thread.
Always use strict. Fixing the warnings will save you hours of debugging, but you must understand the differences.
You are alerting on a signal. Act on a change of signal.
MQL4 (in Strategy Tester) - double testing of entry conditions - MQL5 programming forum #1 2017.12.12