Un indicador muy útil - página 3

 
Vitalii Ananev:

¿Tienen algo así para QuickBooks?

No, sólo escribo expertos para KVIC y eso en Delphi

 
prostotrader:

No, sólo escribo expertos para KVIC y eso en Delphi.

Es una pena. Mi broker sólo tiene quickie. Estoy intentando ponerme al día con lua, pero después de MT no tengo ganas de lua. Nunca he intentado utilizarlo porque parece demasiado complicado y confuso a primera vista. Y no encuentro ningún ejemplo normal con comentarios.

 
prostotrader:

Lo que vas a vender apesta,

pero los gráficos son hermosos).

Prefiero navegar por la web con esta chupa que mirar un gráfico, es más útil.

 
Vitalii Ananev:

Lástima. Mi broker sólo tiene quickie. Estoy tratando de manejar lua, pero después de MT no tengo ganas de lua. Es muy confuso y complicado a primera vista. Y no encontrarás buenos ejemplos con los comentarios.

Lo peor no es eso, sino que no hay un depurador normal,

¡por lo que no se puede probar nada grande en absoluto!

 
__zeus__:

Prefiero navegar por la web con esta basura que enterrarme en un gráfico, es más útil.

Ya te lo he dicho, haz lo que quieras.

 
prostotrader:

Lo peor no es eso, es que no hay un depurador adecuado,

¡por lo que no se puede probar nada grande en absoluto!

Eso también da miedo. He visto que hay una exportación de datos DDE. En la configuración dice que hay que especificar el servidor DDE. En todos los ejemplos se vio el uso del excel. No entiendo si es sólo un error de terminología o es realmente así. Excel debería estar especificado allí comoun servidor D DE, y creo que debería ser al revés: Excel es un cliente DDE y Quick DDE un servidor. Los datos se transfieren de Quicksilver a Excel, no al revés.

 

Este es un indicador útil.

Y ahora esta ST funciona (las divisas son muy volátiles), pero

Por desgracia, sólo en la demo.

Debido al hecho de que hay grandes retrasos en MT5, este TS (Eu sintético)

será poco rentable, aunque, por naturaleza, es 100% rentable

Eu(natural) = Si * ED

Quien esté interesado, puede "jugar"

Imagínese, los que ahora están "sentados" en la Plaza 2 (no hay retrasos).

//+------------------------------------------------------------------+
//|                                                     Eu_ED_Si.mq5 |
//|                                          Copyright 2015, Mikalas |
//|                                              http://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2015"
#property link      "http://www.mql5.com"
#property version   "1.01"
#define  on_call -1111
//
#property indicator_separate_window

#property indicator_buffers 2
#property indicator_plots   2

//--- plot Label1
#property indicator_label1  "Ask"
#property indicator_type1   DRAW_LINE
#property indicator_color1  clrRed
#property indicator_style1  STYLE_SOLID
#property indicator_width1  1

//--- plot Label1
#property indicator_label2  "Bid"
#property indicator_type2   DRAW_LINE
#property indicator_color2  clrRoyalBlue
#property indicator_style2  STYLE_SOLID
#property indicator_width2  1
//--- Levels
#property indicator_level1 0
#property indicator_level2 0
#property indicator_level3 0
#property indicator_level4 0

//---
#property indicator_levelwidth 1
//---
#property indicator_levelstyle STYLE_DOT
//
string ed_symbol;
string si_symbol;
string symb_info;
string eu_b_name;
string si_b_name;
string ed_b_name;
//
input long   LevUp     = 100;   //Макс. уровень индикатора
input long   LevDown   = -100;  //Мин. уровень индикатора
input long   Comis     = 8;    //Комиссии (пункты)  
input long   LevelHigh = 15;   //Линия верхнего уровня (пункты)  
input long   LevelLow  = -15;  //Линия нижнего уровня (пункты)  
input long   EntHigh   = 20;   //Вхрод вверху (пункты)
input long   ExitHigh  = 5;    //Выход вверху (пункты)
input long   EntLow    = -20;  //Вход внизу (пункты)
input long   ExitLow   = -5;   //Выход внизу (пункты)

//--- indicator buffers
double AskBuffer[];
double BidBuffer[];
double eu_sell_price, eu_buy_price,
       ed_sell_price, ed_buy_price,
       si_sell_price, si_buy_price;
double max_value, min_value;   
double si_point, eu_point, ed_point;    
//
int event_cnt;
bool eu_book;
bool si_book;
bool ed_book;
//
enum EXP_STATE
{
  POS_NONE = 0,
  POS_HIGH = 1,
  POS_LOW  = 2
};
struct MEM_PRICES
{
  double eu_price;
  double ed_price;
  double si_price;
};

EXP_STATE exp_state;
MEM_PRICES mem_prices;
long profit;
//+------------------------------------------------------------------+
//| Indicator Set second Symbols function                            |
//+------------------------------------------------------------------+
void SetSecondSymbols( const string aSymbol, string &s_info )
{
  int str_size = StringLen( aSymbol );
    
  for( int i = 0; i < str_size; i++ )
  {
    ushort let_symbol = StringGetCharacter( aSymbol, i );
    if ( let_symbol == '-')
    {
      string hvost = StringSubstr( aSymbol, i, str_size - i );
      s_info = StringSubstr( aSymbol, 0, i );
      
      if ( s_info == "Eu" )
      {
        si_symbol = "Si" + hvost;
        ed_symbol = "ED" + hvost;
      }
      break;
    }
  }
}
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
{
  profit = 0;
  exp_state = POS_NONE;
  max_value = -DBL_MAX;
  min_value = DBL_MAX;
  eu_book = 0;
  si_book = 0;
  ed_book = 0;
  event_cnt = 0;
  SetSecondSymbols(Symbol(), symb_info);
  if(symb_info != "Eu")
  {
    Print("Индикатор должен быть только на символе 'Eu'!");
    return(INIT_FAILED);
  }
//---
  if(!SymbolSelect(ed_symbol, true))
  {
    Print("Нет сивола 'ED'!");
    return(INIT_FAILED);
  }
  if(!SymbolSelect(si_symbol, true))
  {
    Print("Нет сивола 'Si'!");
    return(INIT_FAILED);
  }  
//---
  eu_point = Point();
  ed_point = SymbolInfoDouble(ed_symbol, SYMBOL_POINT);
  si_point = SymbolInfoDouble(si_symbol, SYMBOL_POINT);  
//--- Add book
  eu_book = MarketBookAdd(Symbol());
  if(eu_book == false)
  {
    Print("Стакан символа " + Symbol() + " не добавден!");
    return(INIT_FAILED);
  }
  ed_book = MarketBookAdd(ed_symbol);
  if(ed_book == false)
  {
    Print("Стакан символа " + ed_symbol + " не добавден!");
    return(INIT_FAILED);
  }
  si_book = MarketBookAdd(si_symbol);
  if(si_book == false)
  {
    Print("Стакан символа " + si_symbol + " не добавден!");
    return(INIT_FAILED);
  }
//---  
  IndicatorSetInteger( INDICATOR_DIGITS, Digits() );
  IndicatorSetString( INDICATOR_SHORTNAME, "Eu_Ask_Bid" );
//---  
  SetIndexBuffer( 0, AskBuffer, INDICATOR_DATA );
  PlotIndexSetDouble( 0, PLOT_EMPTY_VALUE, EMPTY_VALUE );
  ArraySetAsSeries( AskBuffer, true );
//---
  SetIndexBuffer( 1, BidBuffer, INDICATOR_DATA );
  PlotIndexSetDouble( 1, PLOT_EMPTY_VALUE, EMPTY_VALUE );
  ArraySetAsSeries( BidBuffer, true );
//---
  IndicatorSetInteger(INDICATOR_LEVELCOLOR, 0, clrAqua);
  IndicatorSetInteger(INDICATOR_LEVELCOLOR, 1, clrAqua);
  IndicatorSetInteger(INDICATOR_LEVELCOLOR, 2, clrRed);
  IndicatorSetInteger(INDICATOR_LEVELCOLOR, 3, clrRoyalBlue); 
//---
  IndicatorSetDouble(INDICATOR_LEVELVALUE, 0, LevelHigh);
//  IndicatorSetDouble( INDICATOR_LEVELVALUE, 1, LevelExitHigh );
  IndicatorSetDouble(INDICATOR_LEVELVALUE, 1, LevelLow);

  IndicatorSetDouble(INDICATOR_MAXIMUM, LevUp);
  IndicatorSetDouble(INDICATOR_MINIMUM, LevDown);
//---
  //---Set objects
   int window=ChartWindowFind(ChartID(),"Eu_Ask_Bid");
   ObjectCreate(ChartID(),"Eu_label_1",OBJ_LABEL,window,0,0);
   ObjectSetInteger(ChartID(),"Eu_label_1",OBJPROP_YDISTANCE,20);
   ObjectSetInteger(ChartID(),"Eu_label_1",OBJPROP_XDISTANCE,0);
   ObjectSetInteger(ChartID(),"Eu_label_1",OBJPROP_COLOR,clrWhite);
   ObjectSetString(ChartID(),"Eu_label_1",OBJPROP_TEXT,"Position: " + EnumToString(exp_state));
   ObjectCreate(ChartID(),"Eu_label_2",OBJ_LABEL,window,0,0);
   ObjectSetInteger(ChartID(),"Eu_label_2",OBJPROP_YDISTANCE,40);
   ObjectSetInteger(ChartID(),"Eu_label_2",OBJPROP_XDISTANCE,0);
   ObjectSetInteger(ChartID(),"Eu_label_2",OBJPROP_COLOR,clrLime);
   ObjectSetString(ChartID(),"Eu_label_2",OBJPROP_TEXT,"Profit: " + string(profit) + " points");
//---
  ChartRedraw();
  return( INIT_SUCCEEDED );
}
//+------------------------------------------------------------------+
// Custom indicator DeInit function                                  |
//+------------------------------------------------------------------+
void OnDeinit( const int reason )
{
  ObjectDelete(ChartID(),"Eu_label_1");
  ObjectDelete(ChartID(),"Eu_label_2");
//---  
 if (eu_book == true) MarketBookRelease(Symbol());
 if (ed_book == true) MarketBookRelease(ed_symbol);
 if (si_book == true) MarketBookRelease(si_symbol);
//---  
  if(reason == REASON_INITFAILED)
  {
    Print("Индикатор удалён! Причина - ошибка инициализации.");
    string short_name = ChartIndicatorName( ChartID(), 1, 0);
    ChartIndicatorDelete(ChartID(), 1, short_name); 
  }
}
//+------------------------------------------------------------------+
// Custom indicator On book event function                           |
//+------------------------------------------------------------------+
void OnBookEvent( const string& a_symbol )
{
  if((a_symbol == Symbol()) || (a_symbol == ed_symbol) || (a_symbol == si_symbol))
  {
    eu_sell_price = SymbolInfoDouble(Symbol(), SYMBOL_ASK);
    eu_buy_price = SymbolInfoDouble(Symbol(), SYMBOL_BID);
    ed_sell_price = SymbolInfoDouble(ed_symbol, SYMBOL_ASK);
    ed_buy_price = SymbolInfoDouble(ed_symbol, SYMBOL_BID);
    si_sell_price = SymbolInfoDouble(si_symbol, SYMBOL_ASK);
    si_buy_price = SymbolInfoDouble(si_symbol, SYMBOL_BID);
//---
    double price[]; 
    OnCalculate( event_cnt, event_cnt, on_call, price ); 
  }
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate( const int rates_total,
                 const int prev_calculated,
                 const int begin,
                 const double &price[] )

{
  if(prev_calculated == 0)
  {
    ArrayInitialize(AskBuffer, EMPTY_VALUE);
    ArrayInitialize(BidBuffer, EMPTY_VALUE); 
  }
  else
  {
    if(begin == on_call)
    {
      for(int i = rates_total - 1; i > 0; i--)
      {
        AskBuffer[i] = AskBuffer[i - 1];
        BidBuffer[i] = BidBuffer[i - 1];
      }
    }
    if((ed_sell_price > 0) && (si_sell_price > 0) && (eu_sell_price > 0) &&
       (ed_buy_price > 0) && (si_buy_price > 0) && (eu_buy_price > 0))
    {
      AskBuffer[0] = ed_sell_price * si_sell_price - eu_buy_price;
      BidBuffer[0] = ed_buy_price * si_buy_price - eu_sell_price;
      if ( AskBuffer[0] < min_value ) min_value = AskBuffer[0];
      if ( BidBuffer[0] > max_value ) max_value = BidBuffer[0];
      IndicatorSetDouble(INDICATOR_LEVELVALUE, 2, min_value);
      IndicatorSetDouble(INDICATOR_LEVELVALUE, 3, max_value);
      switch (exp_state)
      {
        case POS_NONE:
          if(BidBuffer[0] >= (EntHigh * Point()))
          {
            mem_prices.eu_price = eu_sell_price;
            mem_prices.ed_price = ed_buy_price;
            mem_prices.si_price = si_buy_price;
            exp_state = POS_HIGH;
          }
          else
          if(AskBuffer[0] <= (EntLow * Point()))
          {
            mem_prices.eu_price = eu_buy_price;
            mem_prices.ed_price = ed_sell_price;
            mem_prices.si_price = si_sell_price;
            exp_state = POS_LOW;
          }
        break;
        case POS_HIGH:
          if(AskBuffer[0] <= (ExitHigh * Point()))
          {
            profit += long((eu_buy_price - mem_prices.eu_price)/eu_point + (ed_sell_price - mem_prices.ed_price)/ed_point + (si_sell_price - mem_prices.si_price)/si_point) - Comis;
            exp_state = POS_NONE;
          }
        break;
        case POS_LOW:
          if(BidBuffer[0] >= (ExitLow * Point()))
          {
            profit += long((mem_prices.eu_price - eu_buy_price)/eu_point + (mem_prices.ed_price - ed_sell_price)/ed_point + (mem_prices.si_price - si_sell_price)/si_point) - Comis;
            exp_state = POS_NONE;
          }
        break;
      }
    }
    else
    {
      AskBuffer[0] = AskBuffer[1];
      BidBuffer[0] = BidBuffer[1];
    }
  }
  ObjectSetString(ChartID(),"Eu_label_1",OBJPROP_TEXT,"Position: " + EnumToString(exp_state));
  ObjectSetString(ChartID(),"Eu_label_2",OBJPROP_TEXT,"Profit: " + string(profit) + " points");
//---
  ChartRedraw();
  event_cnt = rates_total; 
  return(rates_total);
}

//+------------------------------------------------------------------+
 
prostotrader:

Este es un indicador útil.

Y ahora esta ST funciona (las divisas son muy volátiles), pero

Por desgracia, sólo en la demo.

Debido al hecho de que hay grandes retrasos en MT5, este TS (Eu sintético)

será poco rentable, aunque, por naturaleza, es 100% rentable

Eu(natural) = Si * ED

Quien esté interesado, puede "jugar"

Imagínese, los que ahora están "sentados" en la Plaza 2 (no hay retrasos).

¡Gracias! Por supuesto, ¿qué hace falta para que funcione?
 
Alexsandr San:
No estoy seguro de lo que necesito para que funcione, ¡gracias!

Funcionamiento rápido de MT5.

Bueno y escribir un Asesor Exper to (aunque este indicador es un Asesor Experto, sólo que sin colocar órdenes)

Funciona en una cuenta real en modo de simulación.

Как заказать торгового робота на MQL5 и MQL4
Как заказать торгового робота на MQL5 и MQL4
  • www.mql5.com
Главным преимуществом торговых терминалов MetaTrader является возможность создания автоматических торговых систем, способных совершать торговые операции без вмешательства трейдера, что позволяет исключить влияние психологии на результаты торговли. Для этого нужно сформулировать торговую стратегию и реализовать ее в виде программы на языке MQL...
 
prostotrader:

Funcionamiento rápido de MT5.

Bueno y escribir un Asesor Exper to (aunque este indicador es un Asesor Experto, sólo que sin colocar órdenes)

Funciona en una cuenta real en modo de simulación.

Lo siento, ¿cuál es el símbolo (el indicador sólo debería estar en el símbolo "Eu")?

Foto de