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
Been trying to close a position i opened with the same code but the closing code keeps returning NONE. Kere is the code:
#opening metarader on pc
mt.initialize()
#send a buy oder
buy = {'action':mt.TRADE_ACTION_DEAL,
'symbol':'EURUSD',
'volume':0.01,
'type':mt.ORDER_TYPE_BUY,
'price':mt.symbol_info_tick('EURUSD').ask,
'sl':0.0,
'tp':0.0,
'deviation':50,
'magic':2220,
'comment':'algoric buying',
'type_time':mt.ORDER_TIME_GTC,
'type_filling':mt.ORDER_FILLING_FOK,}
buy_oder = mt.order_send(buy)
print (buy_oder)
#closed order
close = {'action':mt.TRADE_ACTION_DEAL,
'symbol':'EURUSD',
'volume':0.01,
'type':mt.ORDER_TYPE_SELL,
'price':mt.symbol_info_tick('EURUSD').bid,
'position':input('ticket'),#ticket i get from the above print stetement
'deviation':20,
'magic':2220,
'comment':'algoric buying',
'type_time':mt.ORDER_TIME_GTC,
'type_filling':mt.ORDER_FILLING_FOK,}
close_order = mt.order_send(close)
print (close_order)#keeps returning NONE