Coding Expert Advisor beginner

 

Hi,

I am new to coding in mql4. Can somebody tell me how do you take the variable that tell if the expert advisor will send only short orders, only long orders or both(the one from Common tab)?

Thanks

Files:
position.jpg  836 kb
 
emmatb:

Hi,

I am new to coding in mql4. Can somebody tell me how do you take the variable that tell if the expert advisor will send only short orders, only long orders or both(the one from Common tab)?

Thanks

You check the ordertype...OrderType=OP_SELL or.._BUY
 
emmatb: how do you take the variable that tell if the expert advisor will send only short orders, only long orders or both(the one from Common tab)?
  1. There isn't any; the EA's code determines what it "will send." The OrderSend will fail if it isn't allowed that direction however.

  2. If you meant how to find out the settings, perhaps you should read the manual. MQL5 ReferenceMarket InfoSymbolInfoIntegerENUM_SYMBOL_INFO_INTEGER
    Constant Description Usage
    SYMBOL_TRADE_MODE_LONGONLY Allowed only long positions SymbolInfoInteger
    SYMBOL_TRADE_MODE_SHORTONLY Allowed only short positions SymbolInfoInteger
 
William Roeder:
  1. There isn't any; the EA's code determines what it "will send." The OrderSend will fail if it isn't allowed that direction however.

  2. If you meant how to find out the settings, perhaps you should read the manual. MQL5 ReferenceMarket InfoSymbolInfoIntegerENUM_SYMBOL_INFO_INTEGER
    Constant Description Usage
    SYMBOL_TRADE_MODE_LONGONLY Allowed only long positions SymbolInfoInteger
    SYMBOL_TRADE_MODE_SHORTONLY Allowed only short positions SymbolInfoInteger
Hi, I already tried this. It seems to show the modes you cand trade on a chart. And the OrderType() is working if you select an order before.