Please edit your post
Please use this to post code . . . it makes it easier to read.
patrick007:
Please edit your post . . . I have the command to check for the desired signal. Problem is, it will trade off the last signal as soon as the EA starts. I want it to wait for the next signal to open positions. Any ideas what to code and where to place it? Any helpers please?
<SNIP>
Please use this to post code . . . it makes it easier to read.
For large amounts of code, attach it
Yours if (countOfFastEMATrades() < maxTrades && lastTrade != Time[0]) { double ema10 = iMA(Symbol(), 0, 10, 0, MODE_EMA, PRICE_CLOSE, 1); double ema25 = iMA(Symbol(), 0, 25, 0, MODE_EMA, PRICE_CLOSE, 1); double ema50 = iMA(Symbol(), 0, 50, 0, MODE_EMA, PRICE_CLOSE, 1); if (ema10 < ema25 && ema25 < ema50) { OrderSend(Symbol(), OP_SELL, lotSize, Bid,3,0,0,"Forex 01 Fast EMA Sell"); lastTrade = Time[0]; return; } else if (ema10 > ema25 && ema25 > ema50) { OrderSend(Symbol(), OP_BUY, lotSize, Ask,3,0,0,"Forex 01 Fast EMA Buy"); lastTrade = Time[0]; return; }
Try bool canTrade = countOfFastEMATrades() < maxTrades && lastTrade != Time[0]) double ema10 = iMA(Symbol(), 0, 10, 0, MODE_EMA, PRICE_CLOSE, 1); double ema25 = iMA(Symbol(), 0, 25, 0, MODE_EMA, PRICE_CLOSE, 1); double ema50 = iMA(Symbol(), 0, 50, 0, MODE_EMA, PRICE_CLOSE, 1); bool buyTrade = ema10 < ema25 && ema25 < ema50; bool sellTrade = ema10 > ema25 && ema25 > ema50 static bool buySigCurr = true, bool buySigPrev = buySigCurr; static bool sellSigCurr = true; bool sellSigPrev = sellSigPrev; buySigCurr = canTrade && buyTrade; sellSigCurr = canTrade && sellTrade; if (buySigCurr && !buySigPrev){ OrderSend(Symbol(), OP_SELL, lotSize, Bid,3,0,0,"Forex 01 Fast EMA Sell"); lastTrade = Time[0]; return; } else if (sellSigCurr && !sellSigPrev) { OrderSend(Symbol(), OP_BUY, lotSize, Ask,3,0,0,"Forex 01 Fast EMA Buy"); lastTrade = Time[0]; return; }
- What are Function return values ? How do I use them ? - MQL4 forum
- Not adjusting for 4/5 digit brokers (slippage)
WHRoeder:
For large amounts of code, attach it
Yours Try - What are Function return values ? How do I use them ? - MQL4 forum
- Not adjusting for 4/5 digit brokers (slippage)
Thanks for reply. When compiling lots of errors.
patrick007:
Is this any easier?
No, please edit your first post above.
Is this any easier?
RaptorUK:
No, please edit your first post above.
No, please edit your first post above.
Thanks. Not sure what you are implying. Instead of copying and pasting, I have attached it as you specified on the second reply.
I think we are talking in riddles here! Anyhow, the code WHRoeder sent has 18 errors. Are you able to offer any help? Even if it has 17 errors it would be a step forward!
Hi patrick007,
How's sponge bob 008 ?
Since you using different period, checking crossing will cost much work to do.
Whether its first attached or not and no opened position, then you have to scan back at least one bar to see if trade condition is true, if its true and trading condition for current bar is also true then don't open position. If trade condition for last bar is false and true for current bar then open position.

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 the command to check for the desired signal. Problem is, it will trade off the last signal as soon as the EA starts. I want it to wait for the next signal to open positions. Any ideas what to code and where to place it? Any helpers please?
<SNIP>