- EMA_WMA EA ECN mode
- [ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3.
- Checking Candle Open
You need to print more debugging info . . . add more variables into your error print statement . . . for example, had you adjusted your TakeProfit extern variable ?
I'm not sure I've got you. Do you mean you want me to print all the input variables along with the error? I've not adjusted TP. In fact I only want to see how the entries are made.
I'm not sure I've got you. Do you mean you want me to print all the input variables along with the error? I've not adjusted TP. In fact I only want to see how the entries are made.
To find what is causing your issue you need as much information as possible, for example what was the Spread when this error occurred ? if you print Bid & Ask at the time when the error occurs you would have been able to answer the question . . .
Is your Broker an ECN Broker ?
- Not adjusting for 4/5 digit broker, not adjusted for ECN brokers.
//++++ These are adjusted for 5 digit brokers. int pips2points; // slippage 3 pips 3=points 30=points double pips2dbl; // Stoploss 15 pips 0.015 0.0150 int Digits.pips; // DoubleToStr(dbl/pips2dbl, Digits.pips) int init(){ if (Digits % 2 == 1){ // DE30=1/JPY=3/EURUSD=5 forum.mql4.com/43064#515262 pips2dbl = Point*10; pips2points = 10; Digits.pips = 1; } else { pips2dbl = Point; pips2points = 1; Digits.pips = 0; } // OrderSend(... Slippage.Pips * pips2points, Bid - StopLossPips * pips2dbl //---- These are adjusted for 5 digit brokers. /* On ECN brokers you must open first and THEN set stops int ticket = OrderSend(...) if (ticket < 0) Alert("OrderSend failed: ", GetLastError()); else if (!OrderSelect(ticket, SELECT_BY_TICKET)) Alert("OrderSelect failed: ", GetLastError()); else if (!OrderModify(OrderTicket()...) Alert("OrderModify failed: ", GetLastError()); */
- Add print statement to your code to find out why.
- Add code to prevent that
int start(){ static datetime Time0; if (Time0 == Time[0]); return; Time0 = Time[0];
total = OrdersTotal(); if (total < 1)
This make the EA incompatable with every other including itself on other charts.total = 0; for(iPos = OrdersTotal()-1; iPos >= 0 ; iPos--) if ( OrderSelect(iPos, SELECT_BY_POS) // Only my orders w/ && OrderMagicNumber() == magic.number // my magic number && OrderSymbol() == Symbol() // and my pair. ){ total++; } if (total < 1)
- You must count down when closing.
Hi all,
My broker is ECN, even though I don't know what ECN stands for. But anyway, I only have demo accounts for MT4, no real yet. At the moment, I am just learning how to right my own program.
WHRoeder, Thank you very much for the detailed code, and I am not able to understand all of it now, and have to get back to it later on. For the time being, I open a 4-digit demo account. And my question is, is your code necessary for trading or it's just for printing? If for trading, then is it necessary for entries or only for SL and TP?
And thank you all for the useful comments.
tapo
Hi all,
My broker is ECN, even though I don't know what ECN stands for.
With an ECN Broker you MUST send the order with TP & SL set to 0 then do an OrderModify to add the SL & TP . . .
Plenty of info here: http://crum.be/ecn
With an ECN Broker you MUST send the order with TP & SL set to 0 then do an OrderModify to add the SL & TP . . .
Plenty of info here: http://crum.be/ecn
Thank you Raptor,
http://i39.tinypic.com/24b5ifa.png
Now the issue with the EA is that is opens only long positions and it does not wait for a candle to close. After I set TP and SL to 0, it opened a trade with no crossover. Just for the short MA was above the long MA. I want it to 1) open short position 2) open position only upon crossovers only. 3) wait for a candle to close (in my case at the end/beginning of a 5-min candle, and not any time else within it)
Could you help in this.
Thanks,
tapo
I have done some research and written this code to make the EA wait for the close of a bar.
bool isNewBar() { static datetime NewTime = 0; bool NewBar = false; if (NewTime != Time[0]) { NewTime = Time[0]; NewBar = true; } return (NewBar); }
Can you assist me in figuring out why it does not trigger sell orders?

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use