1) check the use of ask and bid. buys you open at Ask, and close at bid.
2) you do not show any definition of _symbol -- so I can only make a guess that this is NOT defined correctly.
EDIT: try changing the _symbol to _Symbol. See if that fixes it. After -- you have fixed the ask and bid.Hi
Check also the Lots value you use perhaps this is some wrong number not allowed by the broker. Also you can use _Symbol instead of this _symbol you defined you use current ask price from current symbol so the name of the symbol for Buy should also be _Symbol (current chart) not some other value. To be perfectly correct you should also check if you can place order with those sl/tp levels checking stoplevel and freeze level or check required margin for the lots you used, but those are not so important now when you have invalid type order issue. But remember about this in the future.
Have a nice day👍📊
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi
I've written a very simple code to buy if a cross between MAs occurs. But the error is "Invalid order type". All the parameters could be found like ask and Bstl but it could not open position.
this is m_Trade
#include <Trade\Trade.mqh>
CTrade m_Trade;
can u help me please.