Basé sur la stratégie "Div hunter"

 

Je pensais que lorsque le trading sur SPOT est arrêté, cela peut être utilisé assez

stratégie de risque (Fut Gap). Sa signification est que nous n'achetons pas d'actions , mais vendons uniquement des contrats à terme.

avec le Gap mis en place par nous.

Lorsque les actions sont négociées, nous calculons le delta moyen entre les contrats à terme et les actions, et lorsque

la négociation des actions est terminée, nous passons un ordre (ordres) pour la vente de contrats à terme (delta calculé + notre Gap).

Et le matin nous vendons des contrats à terme

(la question est de savoir comment vendre si la position est suffisamment importante ?).


 //+------------------------------------------------------------------+
//|                                                      Fut_gap.mq5 |
//|                                     Copyright 2019, prostotrader |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2019, prostotrader"
#property link        "https://www.mql5.com"
#property version    "1.00"
//---
#include   "AutoMagic.mqh"
//--
input long PrGap        = 100 ;         //Гап вверх(пункты)
input string DeltaStart = "10:00:00" ; //Время начала расчета дельты
input string DeltaEnd   = "18:38:00" ; //Время конца расчета дельты
input string ClirStart  = "14:00:00" ; //Время начала дневного клиринга
input string ClirEnd    = "14:05:00" ; //Время конца клиринга
input string OrderStart = "19:05:00" ; //Время начала установки ордера
input string OrderEnd   = "23:43:00" ; //Время конца установки ордера
input long   PosMax     = 100 ;         //Максимальное кол-во контрактов
input long   PosEnter   = 5 ;           //Контрактов в ордере
//--- Variables
string fut_symbol, spot_symbol;
bool fut_book, spot_book;
enum POS_STATE
{
  POS_UNKNOWN = - 1 ,
  POS_NONE    = 0 ,
  POS_LONG    = 1 ,
  POS_SHORT   = 2
};
enum TIME_STATE
{
  TIME_UNKNOWN     = - 1 ,
  TIME_DELTA       = 0 ,
  TIME_CLIRING     = 1 , 
  TIME_ORDER       = 2 ,
  TIME_OUT_SESSION = 3
};
enum ENUM_ORD_STATE
{
  ORD_NO_STATE  = 0 ,
  ORD_DO_SET    = 1 ,
  ORD_DO_MODIFY = 2 ,
  ORD_WORK      = 3 ,
  ORD_DO_CANCEL = 4
};
struct EXP_DATA
{
   double contr_size;
   ulong delta_cnt;
   double fut_buy;
   double spot_sell;
   double spot_last;
   long contr_cnt;
   double delta_midle; 
   int spot_digits;
  TIME_STATE time_state;
   ulong st_delta_value;
   ulong end_delta_value;
   ulong st_clir_value;
   ulong end_clir_value;
   ulong st_order_value;
   ulong end_order_value;
  POS_STATE pos_state;
   double step_price;
   ulong ticket;
   ulong req_id;
   ulong magic;
  ENUM_ORD_STATE ord_state;
};
EXP_DATA exp_data;
//+------------------------------------------------------------------+
//| Expert Set Time values function                                  |
//+------------------------------------------------------------------+
ulong SetTimeValue( const string in_str)
{
   int str_size = StringLen (in_str);
   if (str_size == 8 )
  {
     int k = StringFind (in_str, ":" , 2 );
     if (k == 2 )
    {
       string s_hour = StringSubstr (in_str, 0 , k);
      k = StringFind (in_str, ":" , 5 );
       if (k == 5 )
      {
         string s_min = StringSubstr (in_str, 3 , k- 3 );
         string s_sec = StringSubstr (in_str, 6 , str_size - k - 1 );
         ulong t_sec = ulong ( StringToInteger (s_sec));
         ulong t_min = ulong ( StringToInteger (s_min)) * 60 ;
         ulong t_hour = ulong ( StringToInteger (s_hour)) * 3600 ;
         return (t_hour + t_min + t_sec);
      }
    }
  }
   return ( 0 );
}
//+------------------------------------------------------------------+
//| Expert Get Spot name function                                    |
//+------------------------------------------------------------------+
string GetSpot( const string fut_name)
{
   string Spot = "" ; 
   if (fut_name != "" )
  {
     int str_tire = StringFind (fut_name, "-" );
     if (str_tire > 0 )
    {
      Spot = StringSubstr (fut_name, 0 , str_tire);
       if (Spot == "GAZR" ) Spot = "GAZP" ; else
       if (Spot == "SBRF" ) Spot = "SBER" ; else
       if (Spot == "SBPR" ) Spot = "SBERP" ; else
       if (Spot == "TRNF" ) Spot = "TRNFP" ; else
       if (Spot == "NOTK" ) Spot = "NVTK" ; else
       if (Spot == "MTSI" ) Spot = "MTSS" ; else
       if (Spot == "GMKR" ) Spot = "GMKN" ; else
       if (Spot == "SNGR" ) Spot = "SNGS" ; else
       if (Spot == "Eu" )   Spot = "EURRUB_TOD" ; else
       if (Spot == "Si" )   Spot = "USDRUB_TOD" ; else
       if (Spot == "SNGP" ) Spot = "SNGSP" ;
    }
  }  
   return (Spot);
}
//+------------------------------------------------------------------+
//| Expert Chek position function                                    |
//+------------------------------------------------------------------+
POS_STATE CheckPosState()
{
  exp_data.contr_cnt = 0 ;
   if ( PositionSelect (fut_symbol))
  {
    exp_data.contr_cnt =   long ( PositionGetDouble ( POSITION_VOLUME ));
     ENUM_POSITION_TYPE pos_type = ENUM_POSITION_TYPE ( PositionGetInteger ( POSITION_TYPE ));
     switch (pos_type)
    {
       case POSITION_TYPE_BUY :
         return (POS_LONG);
       break ;
       case POSITION_TYPE_SELL :
         return (POS_SHORT);
       break ;
    }
  }
   else return (POS_NONE);
   return (POS_UNKNOWN);
}
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit ()
{
  fut_symbol = Symbol ();
  spot_symbol = GetSpot(fut_symbol);
   if (spot_symbol == "" )
  {
     Alert ( "Не получено имя СПОТа!" );
     return ( INIT_FAILED );
  }
   else
  {
     if ( SymbolSelect (spot_symbol, true ) == false )
    {
       Alert ( "Нет смвола с именем " + spot_symbol + "!" );
       return ( INIT_FAILED );
    }
     else
    {
      spot_book = MarketBookAdd (spot_symbol);
       if (spot_book == false )
      {
         Alert ( "Не добавлен стакан СПОТа!" );
         return ( INIT_FAILED );
      }
    }
  } 
  fut_book = MarketBookAdd (fut_symbol);
   if (fut_book == false )
  {
     Alert ( "Не добавлен стакан фьючерса!" );
     return ( INIT_FAILED );
  }
//---
  exp_data.pos_state = CheckPosState();  
  exp_data.delta_cnt = 0 ;
  exp_data.fut_buy = 0 ;
 // exp_data.fut_sell = 0;
 // exp_data.spot_buy = 0;
  exp_data.spot_sell = 0 ;
  exp_data.spot_digits = int ( SymbolInfoInteger (spot_symbol, SYMBOL_DIGITS ));
  exp_data.spot_last = SymbolInfoDouble (spot_symbol, SYMBOL_LAST );
  exp_data.delta_midle = 0 ;
  exp_data.step_price = SymbolInfoDouble (fut_symbol, SYMBOL_TRADE_TICK_SIZE );
  exp_data.contr_size = SymbolInfoDouble (fut_symbol, SYMBOL_TRADE_CONTRACT_SIZE );
  exp_data.st_delta_value = SetTimeValue(DeltaStart);
  exp_data.end_delta_value = SetTimeValue(DeltaEnd);
  exp_data.st_clir_value = SetTimeValue(ClirStart);
  exp_data.end_clir_value = SetTimeValue(ClirEnd);
  exp_data.st_order_value = SetTimeValue(OrderStart);
  exp_data.end_order_value = SetTimeValue(OrderEnd);
//---
   if ((exp_data.st_delta_value > 0 ) && (exp_data.end_delta_value > 0 ) &&
     (exp_data.st_clir_value > 0 ) && (exp_data.end_clir_value > 0 ) &&
     (exp_data.st_order_value > 0 ) && (exp_data.end_order_value > 0 ))
  {
    exp_data.magic = GetMagic(fut_symbol);
     if (exp_data.magic == 0 ) 
    {
       Alert ( "Не установлен магик!" );
       return ( INIT_FAILED );
    }
     return ( INIT_SUCCEEDED );
  }
   else return ( INIT_FAILED );
}
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit ( const int reason)
{
   if (fut_book == true ) MarketBookRelease (fut_symbol);
   if (spot_book == true ) MarketBookRelease (spot_symbol);
   if (reason == REASON_INITFAILED )
  {
     Print ( "Эксперт удалён! Причина - ошибка инициализации." );
     ExpertRemove ();
  }
}
//+------------------------------------------------------------------+
//| Expert Check Trade Time function                                 |
//+------------------------------------------------------------------+
TIME_STATE CheckTradeTime()
{
   MqlDateTime dt_str;
   TimeTradeServer (dt_str);
   if (dt_str.year > 0 )
  {
     ulong cur_time = ulong (dt_str.sec) + ulong (dt_str.min * 60 ) + ulong (dt_str.hour * 3600 );
     if ((cur_time >= exp_data.st_delta_value) && (cur_time <= exp_data.end_delta_value))
    {
       return (TIME_DELTA);
    }
     else
    {
       if ((cur_time >= exp_data.st_clir_value) && (cur_time <= exp_data.end_clir_value))
      {
         return (TIME_CLIRING);
      }
       else
      {
         if ((cur_time >= exp_data.st_order_value) && (cur_time <= exp_data.end_order_value))
        {
           return (TIME_ORDER);
        }
         else return (TIME_OUT_SESSION);
      }
    }
  }
   return (TIME_UNKNOWN);
}
//+------------------------------------------------------------------+
//| Expert Points to price function                                  |
//+------------------------------------------------------------------+
double PointsToPrice( const long a_points)
{
   double a_price = ( double (a_points) * Point () ) / exp_data.step_price;
   if (a_points < 0 )
  {
    a_price = MathFloor (a_price) * exp_data.step_price;
  }
   else
  {
    a_price = MathCeil (a_price) * exp_data.step_price;
  }
   return ( NormalizeDouble (a_price, Digits ()));
}
//+------------------------------------------------------------------+
//| Expert Set Delta Value function                                  |
//+------------------------------------------------------------------+
void SetDeltaValue()
{
  exp_data.fut_buy = SymbolInfoDouble (fut_symbol, SYMBOL_BID );
  exp_data.spot_sell = SymbolInfoDouble (spot_symbol, SYMBOL_ASK );
   if ((exp_data.fut_buy > 0 ) && (exp_data.spot_sell > 0 ))
  {
     double cur_delta = (exp_data.fut_buy - exp_data.spot_sell * exp_data.contr_size);
     double tmp_delta = exp_data.delta_midle * exp_data.delta_cnt;
    exp_data.delta_cnt++;
    exp_data.delta_midle = (tmp_delta + cur_delta)/exp_data.delta_cnt;
  }
}
//+------------------------------------------------------------------+
//| Expert Place Order function                                      |
//+------------------------------------------------------------------+
bool PlaceOrder( const long volume)
{
   if ((exp_data.delta_cnt > 0 ) && (exp_data.delta_midle > 0 ))
  {
    exp_data.spot_last = SymbolInfoDouble (spot_symbol, SYMBOL_LAST ); 
     long delta = long (exp_data.delta_midle/Point());
     double price = exp_data.spot_last * exp_data.contr_size + PointsToPrice(delta + PrGap); 
     double max_price = SymbolInfoDouble (fut_symbol, SYMBOL_SESSION_PRICE_LIMIT_MAX );
     double min_price = SymbolInfoDouble (fut_symbol, SYMBOL_SESSION_PRICE_LIMIT_MIN );
     if ((price >= min_price) && (price <= max_price))
    {
       MqlTradeRequest request = { 0 };
       MqlTradeResult   result  = { 0 };
      exp_data.ticket = 0 ;
      exp_data.req_id = 0 ;
      request.action = TRADE_ACTION_PENDING ;
      request.magic  = exp_data.magic;
      request.symbol = fut_symbol;
      request.volume = double (volume);
      request.price  = price;
      request.type = ORDER_TYPE_SELL_LIMIT ;
      request.comment = "Отложенный ордер..." ;      
      request.type_filling = ORDER_FILLING_RETURN ;
      request.type_time = ORDER_TIME_DAY ;
//--- Send order
       if ( OrderSendAsync (request, result) == true )
      {
         if ((result.retcode == TRADE_RETCODE_PLACED ) || (result.retcode == TRADE_RETCODE_DONE )) 
        {
          exp_data.req_id = result.request_id;
           if (exp_data.req_id > 0 ) exp_data.ord_state = ORD_DO_SET;
        }
         else
        {
           Print (result.retcode, "; PleceOrder: Ордер не установлен!" );
        }
      }
       else
      {
         Print (result.retcode, "; PlaceOrder: Ордер не отослан!" );
      }
    }
  }
   return ( false );
}
//+------------------------------------------------------------------+
//| Expert Set Order function                                         |
//+------------------------------------------------------------------+
void SetOrder( const double o_vol, const bool buy_sell)
{
   MqlTradeRequest request = { 0 };
   MqlTradeResult   result  = { 0 };
  exp_data.req_id = 0 ;
  exp_data.ticket = 0 ;
//--- Fill structure
  request.magic = exp_data.magic;
  request.symbol = fut_symbol;
  request.volume = o_vol; 
  request.type_filling = ORDER_FILLING_IOC ;
  request.type_time = ORDER_TIME_DAY ;
  request.action = TRADE_ACTION_DEAL ;
  request.comment = "Рыночный ордер..." ;
   if (buy_sell == true )
  {
    request.type = ORDER_TYPE_BUY ;
  }
   else
  {
    request.type = ORDER_TYPE_SELL ;
  }
//--- Send order
   if ( OrderSendAsync (request, result))
  {
     if ((result.retcode == TRADE_RETCODE_PLACED ) || (result.retcode == TRADE_RETCODE_DONE ))
    {
      exp_data.req_id = result.request_id;
       if (exp_data.req_id > 0 ) exp_data.ord_state = ORD_DO_SET;  
    }
     else
    {
       Print (result.retcode, "; SetOrder: Ордер не установлен!" );
    }
  }
   else
  {
     Print (result.retcode, "; SetOrder: Ордер не отправлен!" );
  }
}
//+------------------------------------------------------------------+
//| Expert Close position function                                   |
//+------------------------------------------------------------------+
void RemoveOrder()
{
  exp_data.req_id = 0 ;
   MqlTradeRequest request = { 0 };
   MqlTradeResult   result  = { 0 };
  request.action = TRADE_ACTION_REMOVE ;
  request.order = exp_data.ticket;
   if ( OrderSendAsync (request, result) == true )
  {
     if ((result.retcode == TRADE_RETCODE_PLACED ) || (result.retcode == TRADE_RETCODE_DONE ))
    { 
      exp_data.req_id = result.request_id;
       if (exp_data.req_id > 0 ) exp_data.ord_state = ORD_DO_CANCEL;
    }
  }
   else
  {
     Print (result.retcode, "; RemoveOrder: Ордер не отослан!" );
  }
}
//+------------------------------------------------------------------+
//| Expert Close position function                                   |
//+------------------------------------------------------------------+
void ClosePosition()
{
   if ( PositionSelect (fut_symbol))
  {
     double a_vol = PositionGetDouble ( POSITION_VOLUME );
     ENUM_POSITION_TYPE pos_type = ENUM_POSITION_TYPE ( PositionGetInteger ( POSITION_TYPE ));
     switch (pos_type)
    {
       case POSITION_TYPE_BUY :
        SetOrder(a_vol, false ); //Sell order
       break ;
       case POSITION_TYPE_SELL :
        SetOrder(a_vol, true );   //Buy order
       break ;     
    }
  }
}
//+------------------------------------------------------------------+
//| Expert Book Event function                                       |
//+------------------------------------------------------------------+
void OnBookEvent ( const string &symbol)
{
   if ((symbol == fut_symbol) || (symbol == spot_symbol))
  {
    exp_data.pos_state = CheckPosState();
     if (exp_data.ord_state == ORD_NO_STATE)
    {
       long a_vol;
       switch (CheckTradeTime())
      {
        case TIME_OUT_SESSION:
          exp_data.delta_midle = 0;
          exp_data.delta_cnt = 0;
        break;
         case TIME_DELTA:
           switch (exp_data.pos_state)
          {
             case POS_UNKNOWN:
             break ;
             case POS_NONE:
              SetDeltaValue();
             break ;
             case POS_LONG:       //Не верно открыта позиция
              ClosePosition();
             break ;
             case POS_SHORT:
              ClosePosition();   //Сразу закрывать позицию (10:00:00)??????? Всю или частями??????????
             break ;
          }
         break ;
         case TIME_ORDER:
           switch (exp_data.pos_state)
          {
             case POS_UNKNOWN:
             break ;
             case POS_NONE:
              PlaceOrder(PosEnter);
             break ;
             case POS_LONG:
              ClosePosition(); //Не верно открыта позиция
             break ;
             case POS_SHORT:   //Добавление позиции
              a_vol = PosMax - exp_data.contr_cnt;
               if (a_vol > 0 )
              {
                 if (a_vol > PosEnter) a_vol = PosEnter; 
                PlaceOrder(a_vol);
              }  
             break ;
          }
         break ;
      }
    }
     else
    {
       switch (exp_data.ord_state)
      {
         case ORD_DO_SET:
           //TODO
         break ;
         case ORD_DO_CANCEL:
           //TODO
         break ;
         case ORD_WORK:
           //TODO
         break ;
      } 
    }
  }
}
//+------------------------------------------------------------------+
//| TradeTransaction function                                        |
//+------------------------------------------------------------------+
void OnTradeTransaction ( const MqlTradeTransaction & trans,
                         const MqlTradeRequest & request,
                         const MqlTradeResult & result)
{
   switch (trans.type)
  {
     case TRADE_TRANSACTION_REQUEST :
       if ((exp_data.req_id > 0 ) && (result.request_id == exp_data.req_id))
      {
         if (result.order > 0 )
        {
          exp_data.ticket = result.order;
          exp_data.req_id = 0 ;
        }
         else
        {
          exp_data.ticket = 0 ;
          exp_data.req_id = 0 ;
          exp_data.ord_state = ORD_NO_STATE;
        }
      }
     break ;
     case TRADE_TRANSACTION_HISTORY_ADD :
       if ((exp_data.ticket > 0 ) && (trans.order == exp_data.ticket))
      {
        exp_data.ticket = 0 ;
        exp_data.req_id = 0 ;
        exp_data.ord_state = ORD_NO_STATE;
      }
     break ;
     case TRADE_TRANSACTION_ORDER_UPDATE :
       switch (trans.order_state)
      {
         case ORDER_STATE_PLACED :
           if ((exp_data.ticket > 0 ) && (trans.order == exp_data.ticket))
          {
             switch (exp_data.ord_state)
            {
               case ORD_DO_SET:
                exp_data.ord_state = ORD_WORK;
               break ;
            }
          }
         break ;
      }
     break ;  
  }   
}
//+------------------------------------------------------------------+

La démo ne fonctionnera pas !

Ajoutée

 //+------------------------------------------------------------------+
//|                                                    AutoMagic.mqh |
//|                                 Copyright 2017-2018 prostotrader |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
//version   "1.01
ulong symb_magic;
//-------------------------------------------------------------------+
// Split string function                                             |
//+------------------------------------------------------------------+
string SplitString( const string a_str, ulong &a_month, ulong &a_year)
  {
   int str_size= StringLen (a_str);
   int str_tire= StringFind (a_str, "-" );
   int str_tochka= StringFind (a_str, "." , str_tire);
   if ((str_tire> 0 ) && (str_tochka> 0 ) &&(str_size > 0 ))
     {
      a_month= ulong ( StringToInteger ( StringSubstr (a_str,str_tire+ 1 ,str_tochka-str_tire- 1 )));
      a_year = ulong ( StringToInteger ( StringSubstr (a_str,str_tochka+ 1 ,str_size-str_tochka- 1 )));
       if ((a_month > 0 ) && (a_year > 0 )) return ( StringSubstr (a_str, 0 , str_tire));
     }
   return ( "" );
  }
//-------------------------------------------------------------------+
// Get Magic function                                                |
//+------------------------------------------------------------------+
ulong GetMagic( const string a_symbol)
{
//--- Get ChartID
  symb_magic = 0 ;
   if ( SymbolSelect ( Symbol (), true ) == false )
  {
     Print ( __FUNCTION__ , ": Нет такого символа!" );
     return ( 0 );
  }
   ulong month = 0 ;
   ulong year = 0 ;
   string new_str = SplitString(a_symbol,month,year);
   if ( StringLen (new_str)> 0 )
  {
     uchar char_array[];
     int result= StringToCharArray (new_str,char_array, 0 , WHOLE_ARRAY , CP_ACP );
     if (result> 0 )
   {
     ulong value;
     for ( int i = 0 ; i < result - 1 ; i++)
     {
       value= ulong (char_array[i]);
       value<<=( 56 -(i* 8 ));
       symb_magic += value;
     }
     month<<= 24 ;
     symb_magic += month;
     year<<= 16 ;
     symb_magic += year;
     return (symb_magic);
   }
 }
   return ( 0 ); 
}
//-------------------------------------------------------------------+
// Is my magic function                                              |
//+------------------------------------------------------------------+
bool IsMyMagic( const ulong m_magic)
{
   if (m_magic > 0 )
  {
     ulong stored_magic=symb_magic;
    stored_magic>>= 16 ;
     ulong in_magic = m_magic;
    in_magic>>= 16 ;
     if (in_magic == stored_magic) return ( true );
  }  
   return ( false );
}
//-------------------------------------------------------------------+
// Get stored magic function                                         |
//+------------------------------------------------------------------+
ulong GetStoredMagic()
{
   if (symb_magic > 0 ) return (symb_magic);
   return ( 0 );  
}
//+------------------------------------------------------------------+
 

A propos, USDRUB_TOM pourrait être un indicateur pour SBER et VTB .

Je dois réfléchir à la manière de le "visser" dans mon EA...

Ajouté

Personne n'a d'idée sur la façon de sortir d'une position avec un grand volume ?

 
Il suffit d'ajouter une fonction
void CheckOrderState()
Et décider comment clôturer une position importante....
Dossiers :
Fut_gap.mq5  46 kb
 
prostotrader:

....

Ajouté

Personne n'a d'idée sur la façon de sortir de sa position, avec un volume élevé ?

En petites portions. Fixer une limite sur le prix au-dessus/en dessous duquel fermer la position par portions. Par exemple, vous prenez une position d'achat. Vous définissez une limite pour fermer la position par le prix supérieur à 100 RUB. Et si le prix est supérieur à 100, vous vendez par portions ou par limite ou au prix du marché.

 
prostotrader:

J'ai pensé qu'avec l'arrêt de l'activité de SPOT, cela pourrait être utilisé de manière assez simple.

stratégie risquée (Fut Gap). L'idée est que nous n'achetons pas d'actions, mais que nous vendons des contrats à terme.

avec le Gap que nous avons mis en place.

Lorsque l'action est négociée, nous calculons le delta moyen entre les contrats à terme et l'action, et lorsque l'action est négociée, nous calculons le delta moyen entre les contrats à terme et l'action.

l'action est terminée, nous passons l'ordre de vendre les futures (le delta calculé + notre écart).

Et le matin, nous vendons les contrats à terme.

(La question est de savoir comment vendre, si la position est suffisamment importante).


Ça ne marche pas sur la démo !

Ajouté



Et si on vendait, et que le marché continuait à monter ?

Pour ce qui est de la clôture - cela dépend du volume, s'il est important, je le divise en lots de 5-10 et je le mets dans le spread - cela fonctionne bien dans un marché rapide, mais le processus n'est pas automatisé pour moi.

 

Quelqu'un va-t-il écrire une fonction de sortie pour le poste ?

//+------------------------------------------------------------------+
//| Expert Exit From Position function                               |
//+------------------------------------------------------------------+
void ExitFromPosition()
{
  double pos_price = GetPositionPrice(fut_symbol);
  if(pos_price > 0)
  {
    double cur_price = SymbolInfoDouble(fut_symbol, SYMBOL_ASK);
    //TODO???
  }  
}
Dossiers :
Fut_gap.mq5  50 kb
 
Aleksey Vyazmikin:

Et si vous vendiez et que le marché continuait à monter ?

Vous définissez votre propre "cupidité" :)

input long PrGap        = 100;        //Гап вверх(пункты)
 
prostotrader:

Vous définissez votre propre "cupidité" :)

Je ne comprends pas - nous avons ouvert un short, mais le marché a continué à pousser vers le haut - nous n'avons pas pu le fermer dans la première minute et nous avons utilisé des stops - je ne comprends pas.

prostotrader:

Quelqu'un va-t-il écrire une fonction pour quitter une position ?

Et comment décidez-vous de sortir ? Je peux vous donner un cours sur le travail avec les positions - ouverture/fermeture/modification...

 
Aleksey Vyazmikin:

Je ne comprends pas - nous avons ouvert le court, mais le marché continue à pousser vers le haut - de ne pas fermer à la première minute, sera câblé avec des arrêts - je ne comprends pas.


Je ne comprends pas.

Dans le premier message, il est écrit :

"Il m'est venu à l'esprit que lorsque vous arrêtez les transactions SPOT, vous pourriez utiliser cela d'une manière assez...

stratégierisquée(Fut Gap)"

 
prostotrader:

Vous devez lire attentivement.

Le premier message dit :

"J'ai pensé qu'en arrêtant les opérations sur SPOT, vous pourriez utiliser ce système de manière assez efficace.

stratégierisquée(Fut Gap)"

L'écriture doit être informative, je n'ai jamais rien compris de substantiel.

 
Aleksey Vyazmikin:

Vous devez écrire de manière informative, je ne comprends toujours pas l'essentiel.

Donnez-moi votre numéro de carte, je peux peut-être vous transférer de l'argent. ....

Eh bien, sérieusement, le point est le suivant.

Après l'arrêt des transactions boursières, les contrats à terme continuent de se négocier - de manière SPECULAIRE,

parce que le prix des contrats à terme dépend du prix de l'action. Le jour suivant, l'action peut baisser ou monter (50/50), MAIS !

Le delta entre les futures et l'action hier, est plus grand que le delta aujourd'hui, d'où nos risques (50 - quelques %).

Suivant... Nous voulons vendre les contrats à terme beaucoup plus haut qu'ils ne se sont échangés avant la fermeture de l'action,

donc nos risques = (50 - quelques % sur le delta - quelques % sur le Gap que nous avons fixé).

C'est clair maintenant ?