And let's make a "cartoon" out of it (multicurrency) - page 5

 

Rejoiced too early. The compilation has no errors, but in the Strategy Tester, when the order is opened, the price is not coming to the indicator through this function. I call it this way: OP=PriceOpenLastPos(); but in the code, OP remains equal to zero.

Is it a problem of the tester that it doesn't pass values to the indicator that hangs in the window in visualization mode?

 
Angela писал(а) >>

Rejoiced too early. The compilation has no errors, but in the Strategy Tester, when the order is opened, the price is not coming to the indicator through this function. I call it this way: OP=PriceOpenLastPos(); but in the code, OP remains equal to zero.

Is it a problem of the test, it doesn't pass values to the indicator that hangs in the window in visualization mode?

The indicator cannot see what is going on in the tester. But if there were open orders, it would show them.

 
ALex2008 писал(а) >>

Please reply)

//-------Поиск ордеров
bool WorkOrders(){
      for (int i=OrdersTotal()-1; i>=0; i--){
      if (!OrderSelect( i, SELECT_BY_POS))  continue;
      if (OrderSymbol()!=Symbol())        continue;
      Type = OrderType();
      Ticket=OrderTicket();
      return(true);
  }
  return(false);  
}
 
Vinin >> :

Fixed it... But the problem remains(.

Delete orders DellAllOrders() function doesn't work...

//-------Удаление всех ордеров
void DellAllOrders(){
      if( WorkOrders())OrderClose( Ticket,OrderLots(),OrderClosePrice(),10);
  }
  
//-------Поиск ордеров
bool WorkOrders(){
      for (int i=OrdersTotal()-1; i>=0; i--){
      if (!OrderSelect( i, SELECT_BY_POS))  continue;
      if (OrderSymbol()!=Symbol())        continue;
      Type = OrderType();
      Ticket=OrderTicket();
      return(true);}
  return(false);
  }

I think I should have added





OrderDelete(Ticket);

Like this....?

//-------Удаление всех ордеров, открытых и отложенных
void DellAllOrders(){
      if( WorkOrders()){
      OrderClose( Ticket,OrderLots(),OrderClosePrice(),10);
      OrderDelete( Ticket);}
  }
 
ALex2008 писал(а) >>

Fixed it... But the problem remains(.

DellAllOrders() is not working.

//-------Удаление всех ордеров
void DellAllOrders(){
  for (int i=OrdersTotal()-1; i>=0; i--){
      if (!OrderSelect( i, SELECT_BY_POS))  continue;
      if (OrderSymbol()!=Symbol())        continue;
      if (OrderType()<=OP_SELL) OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),10);
      else OrderDelete(OrderTicket());
  }
}
Deletes pending orders as well.
 
Vinin >> :
Deletes the deferrals, too.

Thank you)

>> I think everything should be working now.

//-------Удаление всех ордеров, открытых и отложенных
void DellAllOrders(){
      if( WorkOrders()){
      if( Type<=1)OrderClose( Ticket,OrderLots(),OrderClosePrice(),10);
      else OrderDelete( Ticket);}
  }
I also noticed a mistake when re-saving EA (I think it will be the same if I just restart the terminal)...
added a check before setting stoploss...


if(WorkOrders())
      if ((Type<=1)&& (Stop==0))SetStop();



//-------Поиск ордеров
bool WorkOrders(){
      for (int i=OrdersTotal()-1; i>=0; i--){
      if (!OrderSelect( i, SELECT_BY_POS))  continue;
      if (OrderSymbol()!=Symbol())        continue;
      Type  = OrderType();
      Ticket=OrderTicket();
      Stop  =OrderStopLoss();
      return(true);}
  return(false);
  }
 
People) Look... Maybe there's something else wrong, something to tweak?
 
ALex2008 >> :
People) Look... Maybe there's something else wrong, something to tweak?
OrderSend(Symbol(), OP_BUYSTOP, 0.1, Enter, 0, 0, Ask+ Profit, 0, 0,0, Green);

>> Is that how it's supposed to go?

Enter+ Profit
 
Swan >> :

>> Is that how it's supposed to work, or is it

It's really a mistake) It's a pendulum, that's right!!! >> Thank you. Reworked it.

 
ALex2008 >> :

The error is true) It's not critical though... >> Thank you.

error 130 all the time.

StopLevel should be checked, for StopLoss and Enter.


>> and icho.

if(b0<b1) StopLoss=b1;
else StopLoss=b0;

>> should the biggest one be chosen?