if((Bid>(HunderterEMAH1+(OffsetHunderterEMA*_Point)))||(Ask<(HunderterEMAH1-(OffsetHunderterEMA*_Point)))){ Seitwaertstrend=false; }else{ Seitwaertstrend=true; }
Simplify your code. Increase Order after stoploss - MQL4 and MetaTrader 4 - MQL4 programming forum № 3- Mino1337: he made it more than once. Where is my Error ?You are looking at a signal. Therefor you open every tick. Act on a change of signal.
if( MACDAktivieren && ADX>30.0 && ZweihundertTageMAK1<ZweihundertTageMAK10 && MACDSignalK1<MACDMainK1 && MACDSignalK2>MACDMainK2 && !MACDGefunden && !Seitwaertstrend){ buyticketMACDSell = OrderSend...
MQL4 (in Strategy Tester) - double testing of entry conditions - Strategy Tester - Expert Advisors and Automated Trading - MQL5 programming forum
Thanks for your Answer.
I have made this:
input bool MACDAktivieren = False; double MACDTakeProfit; double MACDStopLoss; int OffsetHunderterEMA; int TimeframeMACD; int buyticketMACDBuy; int buyticketMACDSell; static bool MACDGefundenBuy=false; static datetime MACDzuerstGesehenBuy; static bool MACDGefundenSell=false; static datetime MACDzuerstGesehenSell; void OnTick() { if(Symbol()=="EURUSD+"){ MACDTakeProfit = 200; MACDStopLoss = 100; OffsetHunderterEMA = 600; TimeframeMACD = 60; } //MACD double HunderterEMAH1 = iMA(_Symbol,PERIOD_H1,100,0,MODE_EMA,PRICE_CLOSE,1); bool Seitwaertstrend = ((Bid>(HunderterEMAH1+(OffsetHunderterEMA*_Point)))||(Ask<(HunderterEMAH1-(OffsetHunderterEMA*_Point)))); double ZweihundertTageMAK1 = iMA(_Symbol,PERIOD_D1,200,0,MODE_EMA,PRICE_CLOSE,1); double ZweihundertTageMAK10 = iMA(_Symbol,PERIOD_D1,200,0,MODE_EMA,PRICE_CLOSE,10); double MACDMainK1 = iMACD(_Symbol,PERIOD_H4,12,26,9,PRICE_CLOSE,MODE_MAIN,1); double MACDSignalK1 = iMACD(_Symbol,PERIOD_H4,12,26,9,PRICE_CLOSE,MODE_SIGNAL,1); double MACDMainK2 = iMACD(_Symbol,PERIOD_H4,12,26,9,PRICE_CLOSE,MODE_MAIN,2); double MACDSignalK2 = iMACD(_Symbol,PERIOD_H4,12,26,9,PRICE_CLOSE,MODE_SIGNAL,2); double ADX = iADX(_Symbol,PERIOD_H4,26,PRICE_CLOSE,MODE_MAIN,1); bool MACDgesehenBuy = MACDGefundenBuy; bool MACDgesehenSell = MACDGefundenSell; MACDGefundenBuy = MACDAktivieren&&ADX>30.0&&ZweihundertTageMAK1>ZweihundertTageMAK10&&MACDSignalK1>MACDMainK1&&MACDSignalK2<MACDMainK2&&!Seitwaertstrend; MACDGefundenSell = MACDAktivieren&&ADX>30.0&&ZweihundertTageMAK1<ZweihundertTageMAK10&&MACDSignalK1<MACDMainK1&&MACDSignalK2>MACDMainK2&&!Seitwaertstrend; if(MACDGefundenBuy){ if(!MACDgesehenBuy){ MACDzuerstGesehenBuy=TimeCurrent();} else if(TimeCurrent()-MACDzuerstGesehenBuy>=3600){ buyticketMACDBuy = OrderSend(_Symbol,OP_BUY,Lots,Ask,3,Ask-(MACDStopLoss*_Point),Ask+(MACDTakeProfit*_Point),"MACD Buy",0,0,Blue); } } if(MACDGefundenSell){ if(!MACDgesehenSell){ MACDzuerstGesehenSell=TimeCurrent();} else if(TimeCurrent()-MACDzuerstGesehenSell>=3600){ buyticketMACDSell = OrderSend(_Symbol,OP_SELL,Lots,Bid,3,Bid+(MACDStopLoss*_Point),Bid-(MACDTakeProfit*_Point),"MACD Sell",0,0,Red); } } }
but the Problem is the same.
The Program Ignore the Delay. I Have other code like this with BollingerBands-Strategie but it is not this Problem.
![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
Hello,
i have a Simple MACD Trend-follow-bot programmed but every Time if he made a Trade, he made it more than once.
Where is my Error ?
Thanks for all Helpes =D And Sry 4 my English