Try this option:
//+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() ... if(IsFillingTypeAllowed(Symbol(),SYMBOL_FILLING_FOK)) m_trade.SetTypeFilling(ORDER_FILLING_FOK); else if(IsFillingTypeAllowed(Symbol(),SYMBOL_FILLING_IOC)) m_trade.SetTypeFilling(ORDER_FILLING_IOC); else m_trade.SetTypeFilling(ORDER_FILLING_RETURN); ... //+------------------------------------------------------------------+ //| Checks if the specified filling mode is allowed | //+------------------------------------------------------------------+ bool IsFillingTypeAllowed(string symbol,int fill_type) { //--- Obtain the value of the property that describes allowed filling modes int filling=(int)SymbolInfoInteger(symbol,SYMBOL_FILLING_MODE); //--- Return true, if mode fill_type is allowed return((filling & fill_type)==fill_type); }

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
Ok so I stared experimenting with EA's and testing and so on.
I understand the basics of programming and realize that if this was written in OOP style it would be a bit easier to navigate. However, I just wanted to start out and see if I could get an EA going with all the parameters I'm after. It's been a ride.
The following code works for everything using 2 EMA cross as a buy signal. However, I've been fighting with the hedging portion of the EA and trying to close a position. Going back and forth I finally get a invalid fill 10030 code when attempting to close the position for a reversal cross of the EMAs.
Please help and thank you
Error
2017.07.09 16:55:08.501 2016.02.19 02:00:59 failed market sell 0.10 EURCHF, close #8 buy 0.10 EURCHF 1.10166 [Unsupported filling mode]
2017.07.09 16:55:08.501 2016.02.19 02:00:59 CTrade::OrderSend: market sell 0.10 position #8 EURCHF [invalid fill]
2017.07.09 16:55:08.501 2016.02.19 02:00:59 PositionClose() method failed. Return code=10030. Code description: invalid fill
: