Download MetaTrader 5

Function Close Buy and Close Sell for EA?

To add comments, please log in or register
Ask your broker to open the official channel. Thousands of traders will read the news!
Luis Henrique
Luis Henrique 2014.09.26 15:53 
Galera alguém consegue me ajudar com esse código abaixo?

eu anexei uma imagem mostrando como fica o EA Anexado em com ordens em Sell abertas, no iMA abaixo ele me mostra que o trend mudou mas não fecha as ordens.

se alguém tiver alguma idéia pra arrumar isso eu posto o EA depois dessa correção.

if (ClosePosition_TrendInverse) {

int ticket = 0;
     if (Bid<iMA(Symbol(),MATF,MA_ClosePeriodH4,0,MODE_SMMA,PRICE_CLOSE,MODE_MAIN)) MC3=1;
     if (Bid>iMA(Symbol(),MATF,MA_ClosePeriodH4,0,MODE_SMMA,PRICE_CLOSE,MODE_MAIN)) MC3=0;
     if (MC3==0){
     if(OrderSelect(1, SELECT_BY_TICKET, MODE_TRADES)==True) ticket=OrderTicket();
     if(OrderClose(ticket,OrderLots(),Ask,3,Red)==True) Print("Sell closed at: ",OrderClosePrice());

     if (MC3==1){
     if(OrderSelect(1, SELECT_BY_TICKET, MODE_TRADES)==True) ticket=OrderTicket();
     if(OrderClose(ticket,OrderLots(),Bid,3,Red)==True) Print("Buy closed at: ",OrderClosePrice());

  if (MC3==0) Trend_Close = "Trend UP H4, Closed Sell";
  if (MC3==1) Trend_Close = "Trend Down H4, Closed Buy";
Close.jpg 101 kb
Luis Henrique
Luis Henrique 2014.09.26 16:26  
Guys can anyone help me with this code below? 

I've attached a picture showing how it looks in the EA Attached to Sell orders in open, magnet below it shows me that the trend has changed but does not close the orders. 

if anyone has any idea to fix this EA after I post this fix. 

Thank you!
Alain Verleyen
Alain Verleyen 2014.09.27 19:01  


in parts of it the result appears in the Journal that attempted to perform the action, but there was an error, ...


Which error ?

To add comments, please log in or register