I don't see any alert in your code
You set CurrencyBuySignal to false, but do not set CurrencySellSignal to false, could this be causing your problem?
I have an EA where I call a custom indicator and have some simple code to read shift 0 and shift 1 and do some comparisons with it and when a certain condition is true I generate an alert signal.
The problem is that instead of getting this one alert signal I get several signals and I cannot understand why.
Here is the simple code. I get an alert signal even when just the middle condition (e.g. EURafter < USDafter) is true and the other two conditions are false !
Sorry guys I thought I copied both lines like this:
CurrencySellSignal = false; CurrencyBuySignal = false;
So that cannot be the problem. I was thinking there could be something wrong with my "if" statements
I don't see any alert in your code
You set CurrencyBuySignal to false, but do not set CurrencySellSignal to false, could this be causing your problem?
Here is the alert code that I did not copy before:
if (Trade == true && Buy == true && BuyTrade == false && BuySignal == true) { PlaySound("Alert.wav"); Alert("ALERT: BUY " + Pair); SendMail("SR System Alert ", "BUY " + Pair + " Timeframe = " + Period()+ "; " + " Date = " + TimeToStr(TimeLocal(),TIME_DATE) + "; " + " Time = " + TimeToStr(TimeLocal(),TIME_MINUTES)); /* Signal++ if (Signal == 3) BuySignal = false;*/ PrevBuyTime = BuyTime; } SellSignal = false; datetime SellTime = iTime(NULL,0,0); if (SellTime != PrevSellTime)SellSignal = true; if (Trade == true && Sell == true && SellTrade == false && SellSignal == true) { PlaySound("Alert.wav"); Alert("ALERT: SELL " + Pair); SendMail("SR System Alert", "SELL " + Pair + " Timeframe = " + Period()+ "; " + " Date = " + TimeToStr(TimeLocal(),TIME_DATE) + "; " + " Time = " + TimeToStr(TimeLocal(),TIME_MINUTES)); PrevSellTime = SellTime; }
Unless I am having a cross-eyed moment, I don't see how the Alert is connected to the previous code that you posted.
CurrencyBuySignal and CurrencySellSignal are not referred to
Sorry guys I thought I copied both lines like this:
Cannot find the way to edit my code after submitting. I left out this part at the beginning of the alert code:
BuySignal = false; datetime BuyTime = iTime(NULL,0,0); if (BuyTime != PrevBuyTime)BuySignal = true; Print("BuySignal is ", BuySignal);
Are thy placed in the position shown in your code above or somewhere else ?
Like they are shown here. Same sequence.
Unless I am having a cross-eyed moment, I don't see how the Alert is connected to the previous code that you posted.
CurrencyBuySignal and CurrencySellSignal are not referred to
Ernest, can you show the relationship between CurrencyBuySignal and CurrencySellSignal and these variables . . .
if (Trade == true && Buy == true && BuyTrade == false && BuySignal == true)
- 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 have an EA where I call a custom indicator and have some simple code to read shift 0 and shift 1 and do some comparisons with it and when a certain condition is true I generate an alert signal.
The problem is that instead of getting this one alert signal I get several signals and I cannot understand why.
Here is the simple code. I get an alert signal even when just the middle condition (e.g. EURafter < USDafter) is true and the other two conditions are false !