Çok kullanışlı gösterge - sayfa 3

 
Vitalii Ananev :

Quik için benzer bir şeyiniz var mı?

Hayır, HIZLI için yalnızca uzmanlar ve ardından Delphi'de yazarım

 
prostotrader :

Hayır, HIZLI için yalnızca uzmanlar ve ardından Delphi'de yazarım

Çok yazık. Brokerim sadece hızlı. Burada lua ile uğraşmaya çalışıyorum ama MT'den sonra ruhum lua ile yatmıyor. Her nasılsa ilk bakışta her şey kafa karıştırıcı ve karmaşık. Ve yorumlarla normal örnekler bulamazsınız.

 
prostotrader :

Ne takas edeceksin - sadece berbat,

gerçekten güzel grafikler :)

Programa bağlı kalmaktansa bu saçmalıkla internette gezinmekten daha iyiyim, daha çok faydası var.

 
Vitalii Ananev :

Çok yazık. Brokerim sadece hızlı. Burada lua ile uğraşmaya çalışıyorum ama MT'den sonra ruhum lua ile yatmıyor. Her nasılsa ilk bakışta her şey kafa karıştırıcı ve karmaşık. Ve yorumlarla normal örnekler bulamazsınız.

En kötüsü bu değil, normal bir hata ayıklayıcı olmaması,

yani büyük bir şey hiç test edilemez!

 
__zeus__ :

Programa bağlı kalmaktansa bu saçmalıkla internette gezinmekten daha iyiyim, daha çok faydası var.

Sana zaten söyledim - istediğini yap.

 
prostotrader :

En kötüsü bu değil, normal bir hata ayıklayıcı olmaması,

yani büyük bir şey hiç test edilemez!

Evet ve bu da rahatsız edici. DDE'de veri aktarımı olduğunu gördüm. Oradaki ayarlarda sunucuyu DDE belirtmek için yazılmıştır. Gördüğüm örneklerde her yerde Excel kullanıyor. Sadece terminolojide bir hata mı var yoksa doğru mu anlamıyorum. Excel orada bir DDE sunucusu olarak belirtilmelidir, ancak teorik olarak Excel DDE istemcisi ve Quick DDE sunucusunun tersi olması gerektiğini düşünüyorum. Veriler Quick'ten Excel'e aktarılır, tersi olmaz.

 

İşte yararlı bir gösterge.

Ve şimdi bu TS çalışıyor (para birimleri oldukça değişken), ancak

ne yazık ki sadece demo .

MT5'te büyük gecikmeler olması nedeniyle, bu TC (sentetik Eu)

doğası gereği %100 kârlı olmasına rağmen kârsız olacaktır

Eu(doğal) = Si * ED

Kimin umurunda, "oynayabilir"

Yüzünün şimdi Plaza 2'de "oturduğunu" hayal ediyorum (gecikme yok)!

 //+------------------------------------------------------------------+
//|                                                     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 :

İşte yararlı bir gösterge.

Ve şimdi bu TS çalışıyor (para birimleri oldukça değişken), ancak

ne yazık ki sadece demo.

MT5'te büyük gecikmeler olması nedeniyle, bu TC (sentetik Eu)

doğası gereği %100 kârlı olmasına rağmen kârsız olacaktır

Eu(doğal) = Si * ED

Kimin umurunda, "oynayabilir"

Yüzünün şimdi Plaza 2'de "oturduğunu" hayal ediyorum (gecikme yok)!

Teşekkür ederim ! Tabii ki, çalışması için ne gerekiyor?
 
Alexsandr San :
Teşekkür ederim ! Tabii ki, çalışması için ne gerekiyor?

Hızlı çalışma MT5.

Peki, bir uzman yazın (bu gösterge bir uzman olmasına rağmen, yalnızca sipariş vermeden)

Simülasyon modunda gerçek hayatta çalışır.

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

Hızlı çalışma MT5.

Peki, bir uzman yazın (bu gösterge bir uzman olmasına rağmen, yalnızca sipariş vermeden)

Simülasyon modunda gerçek hayatta çalışır.

Üzgünüm! ne tür bir sembol (Gösterge sadece 'Eu' sembolü üzerinde olmalıdır!) ?

enstantane fotoğraf