Discusión sobre el artículo "Experto comercial universal: trabajando con órdenes pendientes y cobertura (parte 5)" - página 3

 
Сергей Криушин:
No funciona - estas líneas no están en Impulse mismo....
Según los mensajes del compilador, están en Impulse, pero no pueden ser llamadas porque las funciones Ask, Bid, etc. no están definidas en su versión de CStrategy.
 
Vasiliy Sokolov:
Según los mensajes del compilador están en Impulse, pero su llamada no está disponible porque las funciones Ask, Bid, etc. no están definidas en su versión de CStrategy.
Cómo definirlos allí... la versión debe ser mi versión... insertar de su estrategia de negociación... Ask, Bid, etc son los mismos para todos los comunes...
 
Сергей Криушин:
¿Cómo se definen allí... la versión tiene que ser la mía... insertar desde mi estrategia de negociación ... son Ask, Bid, parece ser el mismo para todos los comunes...
Adjunto en la parte inferior del artículo es el archivo strategyarticle_20.04.16.zip. Descárgalo, descomprimirlo y reemplazar todos los archivos anteriores CStrategy con estos nuevos.
 
Сергей Криушин:
Hay CStrategyList Manager; pero la clase Impuls no está allí... tal vez por eso.
¿Cómo no? MQL5\Include\Strategy\Samples\Impulse.mqh
 
Vasiliy Sokolov:
¿Cómo no? MQL5/Include/Estrategia/Muestras/Impulse.mqh.
Sí, funcionó bien muchas gracias... la otra cuenta funcionó bien.... Supongo que debería haber reiniciado el terminal.... No sé, todo estaba compilando, pero el búho se quedó atascado... asi que lo siento...asi es siempre algo en algun lado... y mire por medio dia...3 veces descargue y revise todo...)))))
 
Como se harían las de stop a las de límite, ya que parece que se piden más las de límite...y cambiar la distancia..... y como reducir el lote a 0.01.... tantas cosas que no encuentro nada...))))
 
Сергей Криушин:
Como se harían las de stop a las de límite, ya que parece que se piden más las de límite...y cambiar la distancia..... y como reducir el lote a 0.01.... tantas cosas que es imposible encontrar nada...))))
MM.SetLotFixed(0.01);
if(buy_stop_total == 0 && task == ORDER_TASK_MODIFY)
   Trade.BuyLimit(MM.GetLotFixed(), target, ExpertSymbol(), 0, 0, NULL);
Como puedes ver, nada complicado. El valor del objetivo lo tendrás que calcular tu.
 
Vasiliy Sokolov:
Como puede ver, nada complicado. Tendrás que calcular tu mismo el valor objetivo.

Lo intenté así desde cero - no funciona - las paradas siguen así....

//+------------------------------------------------------------------+
void CImpulse::InitSell(const MarketEvent &event)
{
   if(!IsTrackEvents(event))return;                      
   if(positions.open_sell > 0) return;                    
   int sell_limit_total = 0;
   ENUM_ORDER_TASK task;
   double target = Ask() - Ask()*(m_percent/100.0);
   if(target < Moving.OutValue(0))                    // El precio de activación de la orden debe estar por encima de la media móvil
      task = ORDER_TASK_DELETE;
   else
      task = ORDER_TASK_MODIFY;
   for(int i = PendingOrders.Total()-1; i >= 0; i--)
   {
      CPendingOrder* Order = PendingOrders.GetOrder(i);
      if(Order == NULL || !Order.IsMain(ExpertSymbol(), ExpertMagic()))
         continue;
      if(Order.Type() == ORDER_TYPE_SELL_LIMIT)
      {
         if(task == ORDER_TASK_MODIFY)
         {
            sell_limit_total++;
            Order.Modify(target);
         }
         else
            Order.Delete();
      }
   }
   if(sell_limit_total == 0 && task == ORDER_TASK_MODIFY)
      Trade.SellLimit(MM.GetLotFixed(), target, ExpertSymbol(), 0, 0, NULL);
}
//+------------------------------------------------------------------+
//| Trabajando con órdenes pendientes SellStop para abrir posiciones cortas.
//| posiciones|
//+------------------------------------------------------------------+
void CImpulse::InitBuy(const MarketEvent &event)
{
   if(!IsTrackEvents(event))return;                      
   if(positions.open_buy > 0) return;                    
   int buy_limit_total = 0;
   ENUM_ORDER_TASK task;
   double target = Bid() + Bid()*(m_percent/100.0);
   if(target > Moving.OutValue(0))                    // El precio de activación de la orden debe estar por encima de la media móvil
      task = ORDER_TASK_DELETE;
   else
      task = ORDER_TASK_MODIFY;
   for(int i = PendingOrders.Total()-1; i >= 0; i--)
   {
      CPendingOrder* Order = PendingOrders.GetOrder(i);
      if(Order == NULL || !Order.IsMain(ExpertSymbol(), ExpertMagic()))
         continue;
      if(Order.Type() == ORDER_TYPE_BUY_LIMIT)
      {
         if(task == ORDER_TASK_MODIFY)
         {
            buy_limit_total++;
            Order.Modify(target);
         }
         else
            Order.Delete();
      }
   }
   if(buy_limit_total == 0 && task == ORDER_TASK_MODIFY)
      Trade.BuyLimit(MM.GetLotFixed(), target, ExpertSymbol(), 0, 0, NULL);
}
 
Сергей Криушин:

Lo intenté así - no funciona - las paradas siguen así.....

Déjame comprobar...
 
Vasiliy Sokolov:
Ahora lo compruebo...

He añadido SL y TP niveles y arrastre a la lechuza - se muestra perfectamente en la demo Metaquotes...al cambiar a real de nuevo algo no ve - da errores - lo principal es que he copiado todo limpiamente, toda la biblioteca - y todavía errores... lo que está mal de nuevo....una gran petición - ¿es posible combinar de alguna manera en una EA con comentarios ... por así decirlo, para una clara comprensión de la esencia de todo lo descrito ... Con gran respeto a su gran trabajo realizado ... muchas gracias ... También me gustaría saber - es sólo yo con tales incomprensiones o alguien más está probando.... y sin errores...

'Trade.mqh'     Trade.mqh       1       1
'Object.mqh'    Object.mqh      1       1
'StdLibErr.mqh' StdLibErr.mqh   1       1
'SymbolInfo.mqh'        SymbolInfo.mqh  1       
'OrderInfo.mqh' OrderInfo.mqh   1       1
'HistoryOrderInfo.mqh'  HistoryOrderInfo.mqh    1       1
'PositionInfo.mqh'      PositionInfo.mqh        1       1
'DealInfo.mqh'  DealInfo.mqh    1       1
'ENUM_ACCOUNT_MARGIN_MODE' - declaration without type   Trade.mqh       36      4
'POSITION_TICKET' - undeclared identifier       PositionInfo.mqh        84      37
'PositionGetInteger' - no one of the overloads can be applied to the function call      PositionInfo.mqh        84      18
'ENUM_ACCOUNT_MARGIN_MODE' - undeclared identifier      PositionInfo.mqh        259     4
'margin_mode' - undeclared identifier   PositionInfo.mqh        259     29
'margin_mode' - some operator expected  PositionInfo.mqh        259     29
'ACCOUNT_MARGIN_MODE' - undeclared identifier   PositionInfo.mqh        259     86
'ACCOUNT_MARGIN_MODE' - cannot convert enum     PositionInfo.mqh        259     86
'AccountInfoInteger' - some operator expected   PositionInfo.mqh        259     67
'ACCOUNT_MARGIN_MODE_RETAIL_HEDG...'. - undeclared identifier      PositionInfo.mqh        264     20
'PositionSelectByTicket' - function not defined PositionInfo.mqh        325     11
'ENUM_ACCOUNT_MARGIN_MODE' - undeclared identifier      PositionInfo.mqh        332     4
'margin_mode' - undeclared identifier   PositionInfo.mqh        332     29
'margin_mode' - some operator expected  PositionInfo.mqh        332     29
'ACCOUNT_MARGIN_MODE' - undeclared identifier   PositionInfo.mqh        332     86
'ACCOUNT_MARGIN_MODE' - cannot convert enum     PositionInfo.mqh        332     86
'AccountInfoInteger' - some operator expected   PositionInfo.mqh        332     67
'ACCOUNT_MARGIN_MODE_RETAIL_HEDG...'. - undeclared identifier      PositionInfo.mqh        334     20
'PositionGetTicket' - function not defined      PositionInfo.mqh        336     20
'position' - struct member undefined    Trade.mqh       196     12
'position' - struct member undefined    Trade.mqh       196     35
'position_by' - struct member undefined Trade.mqh       197     12
'position_by' - struct member undefined Trade.mqh       197     35
'position' - struct member undefined    Trade.mqh       50      85
'position_by' - struct member undefined Trade.mqh       51      85
'm_margin_mode' - undeclared identifier Trade.mqh       94      44
'ENUM_ACCOUNT_MARGIN_MODE' - undeclared identifier      Trade.mqh       94      59
'ACCOUNT_MARGIN_MODE' - undeclared identifier   Trade.mqh       94      103
'ACCOUNT_MARGIN_MODE' - cannot convert enum     Trade.mqh       94      103
'AccountInfoInteger' - some operator expected   Trade.mqh       94      84
'position' - struct member undefined    Trade.mqh       354     14
'POSITION_TICKET' - undeclared identifier       Trade.mqh       354     42
'PositionGetInteger' - no one of the overloads can be applied to the function call      Trade.mqh       354     23
'PositionSelectByTicket' - function not defined Trade.mqh       367     8
'position' - struct member undefined    Trade.mqh       373     14
possible loss of data due to type conversion    Trade.mqh       373     22
'position' - struct member undefined    Trade.mqh       427     20
'POSITION_TICKET' - undeclared identifier       Trade.mqh       427     48
'PositionGetInteger' - no one of the overloads can be applied to the function call      Trade.mqh       427     29
'PositionSelectByTicket' - function not defined Trade.mqh       472     8
'position' - struct member undefined    Trade.mqh       492     14
possible loss of data due to type conversion    Trade.mqh       492     23
'PositionSelectByTicket' - function not defined Trade.mqh       513     8
'PositionSelectByTicket' - function not defined Trade.mqh       517     8
'TRADE_ACTION_CLOSE_BY' - undeclared identifier Trade.mqh       529     26