Baseado na estratégia "Div hunter"

 

Eu pensei que quando a negociação no SPOT é interrompida, isso pode ser usado bastante

estratégia de risco (Fut Gap). Seu significado é que não compramos ações , mas apenas vendemos futuros

com o Gap criado por nós.

Quando as ações são negociadas, calculamos o delta médio entre os futuros e as ações, e quando

a negociação de ações terminou, fazemos um pedido (ordens) para a venda de futuros (delta calculado + nosso Gap).

E de manhã vendemos futuros

(a questão é como vender se a posição for grande o suficiente?).


 //+------------------------------------------------------------------+
//|                                                      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 ;  
  }   
}
//+------------------------------------------------------------------+

A demonstração não funcionará!

Adicionado

 //+------------------------------------------------------------------+
//|                                                    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 propósito, USDRUB_TOM poderia ser um indicador para SBER e VTB .

Tenho que pensar em como "enroscar" na minha EA.

Adicionado

Ninguém tem nenhuma idéia de como sair de uma posição com grande volume?

 
Só é preciso acrescentar uma função
void CheckOrderState()
E decidir como fechar uma grande posição....
Arquivos anexados:
Fut_gap.mq5  46 kb
 
prostotrader:

....

Adicionado

Ninguém tem nenhuma idéia de como sair de posição com grande volume?

Em pequenas porções. Estabelecer um limite no preço acima/abaixo para fechar a posição por porções. Por exemplo, você toma uma posição para comprar. Você estabelece um limite para fechar a posição pelo preço superior a 100 RUB. E se o preço for superior a 100, você vende por porções ou por limite ou preço de mercado.

 
prostotrader:

Ocorreu-me que com a interrupção do SPOT, isto poderia ser usado de forma justa.

estratégia de risco (Fut Gap). A idéia é que nós não compramos ações, mas apenas vendemos futuros

com a Gap que montamos.

Quando a ação é negociada, calculamos o delta médio entre o futuro e a ação, e quando

o estoque é negociado, definimos a(s) ordem(s) para vender os futuros (o delta calculado + nosso Gap).

E pela manhã vendemos os futuros.

(A questão é como vender, se a posição é suficientemente grande?).


Não vai funcionar em demonstração!

Adicionado



E se vendêssemos, e o mercado subisse ainda mais?

Quanto ao fechamento - depende do volume, se for grande, eu o quebro em lotes de 5-10 e o coloco no spread - funciona bem em um mercado rápido, mas o processo não é automatizado para mim.

 

Alguém vai escrever uma função de saída para a posição?

//+------------------------------------------------------------------+
//| 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???
  }  
}
Arquivos anexados:
Fut_gap.mq5  50 kb
 
Aleksey Vyazmikin:

E se você se esgotasse e o mercado subisse ainda mais?

Você define sua própria "ganância" :)

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

Você define sua própria "ganância" :)

Não entendo - abrimos um curto-circuito, mas o mercado continuava a subir - não conseguíamos fechá-lo no primeiro minuto e usávamos paradas - não entendo.

prostotrader:

Alguém vai escrever uma função para sair de um cargo?

E como você decide sair? Posso dar uma aula sobre como trabalhar com posições - abertura/fecho/modificação...

 
Aleksey Vyazmikin:

Não entendo - abrimos o curto, mas o mercado continua a pressionar para cima - não fechar no primeiro minuto, será interligado com paradas - não entendo.


Eu não entendo.

No primeiro post, diz:

"Ocorreu-me que quando você pára o SPOT, você poderia usar isso em uma

estratégia derisco(Fut Gap)".

 
prostotrader:

Você precisa ler com atenção.

O primeiro posto diz:

"Ocorreu-me que ao parar de negociar no SPOT você poderia usar isso em um

estratégia derisco(Fut Gap)".

A escrita deve ser informativa, eu nunca entendi nada de substância.

 
Aleksey Vyazmikin:

Você tem que escrever informativamente, eu ainda não entendi o essencial.

Dê-me seu número de cartão, talvez eu possa transferir dinheiro para você....

Bem, a sério, a questão é esta.

Depois que a negociação de ações pára, os futuros continuam a ser negociados - ESPECULATIVAMENTE,

porque o preço dos futuros depende do preço das ações. No dia seguinte, o estoque pode cair ou subir (50/50), MAS!

O delta entre o futuro e o estoque ontem, é maior do que o delta hoje, daí nossos riscos (50 - alguns %).

A seguir... Queremos vender os futuros muito mais altos do que eles negociaram antes do fechamento das ações,

portanto, nossos riscos = (50 - alguns % sobre o delta - alguns % sobre o Gap que estabelecemos).

Está claro agora?

Razão: