[Archive] Learn how to make money villagers! - page 362

 
valenok2003:


I personally always use a real opening check, not trusting the returned value


That's right... I had no idea that a ticket could be assigned and an order not opened/set...

I will take it on board. Thank you.

 

I have not yet seen any errors when closing, so a standard check will suffice

//+-------
//+------------------------------------------------------------------+
//|   valenok2003@mail.ru                                18.07.2011
//+------------------------------------------------------------------+
//| close_all_this_symbol() закрытие ВСЕХ ордеров по символу и магику
//| Возвращает true при успехе, в противном случае false
//+------------------------------------------------------------------+
bool close_all_this_symbol(int _Magic) {  
   string _Function = "close_all_this_symbol(): ";
//-----------------
   bool   _SUCCES = true,
          _RET = true;
   color  _Color_Arrow;
   int    _ERROR;
//-----------------
   output_mov_string("закрытие рыночных ордеров", Clr_Action);
   for(int _i=OrdersTotal()-1; _i>=0; _i--) 
   {  OrderSelect(_i, SELECT_BY_POS, MODE_TRADES);
      if (OrderSymbol() == Symbol() && OrderMagicNumber()==_Magic) {
         if(OrderType()==OP_BUY)  _Color_Arrow = Color_Arrow_Buy;
         if(OrderType()==OP_SELL) _Color_Arrow = Color_Arrow_Sell;
         _SUCCES = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), Slip, _Color_Arrow);
         _ERROR = GetLastError();
         if(!_SUCCES) {    // есть неудача
            _RET = false;
            error(_Function, _ERROR);
         }
      }
   }
   if(_RET) output_mov_string("все ордера закрыты", Clr_Report);
//-----------------
   return(_RET);
}
//+-------------------------------------------------------------------
//+-------
 
That's why I like Osma - he doesn't open the averaging overtly, he waits for the right moment. Now the second buy is waiting for the downward wave, but so far it is silent) That's the value, he does not make unnecessary positions, only for the cause.
 
OnGoing:
That's why I like Osma - it doesn't open the averaging overtly, it waits for the right moment. That's the great thing - it does not opens positions without waiting for the right moment.


Indeed. In this case the "pauses" are appropriate...

Osma averaging is better than a simple set interval in pips...

 
And I'm still not trading like this)
 
RVD:
I'm still not trading like this)

Reconnect and restart, check communication with broker, turn on speakers for audio...
 
joo:
Yes, for some reason sometimes the signal doesn't open. I've looked around and can't figure out why, there's a bug in the code.
Opening depends not only on OsM signal, but also on condition if (PrevCl > CurrCl), and they do not always coincide. This is the reason.
 
Roman.:

Reconnect and restart, check communication with broker, turn on speakers for audio...

Yes, I've tried everything many times) now I've opened a buy) it's about something else... Probably this is what you wrote)

The opening depends not only on the OsM signal, but also on the condition if (PrevCl > CurrCl), and they do not always coincide. This is the reason.

 
khorosh:
The opening depends not only on the OsM signal but also on the condition if (PrevCl > CurrCl) and they do not always coincide. This is the reason.

Nah, I took that out, just put Osma in its place) But that's only a place to enter for the first time, when there are no open orders at all.

There is a separate spot for averaging, the same condition there.

 
OnGoing:

Nah, I took that out, just put Osma in its place) But that's only a place to enter for the first time, when there are no open orders at all.

There is a separate spot for averaging, the same condition there.

The old version has condition if (PrevCl > CurrCl), and I haven't looked at the new one.