Переписать индикатор с руланга на mg5

MQL5 Indicadores

Trabalho concluído

Tempo de execução 3 horas
Comentário do cliente
Работу выполнил от... и до...
Comentário do desenvolvedor
Однозначное ТЗ и никаких задержек с проверкой результата - всё отлично.

Termos de Referência

Переписать индикатор с Руланг(Румус) Форекс Клуба на mg5

Есть код на Руланг , и на mg4. Базовая версия, с которой будем сравнивать естественно код Румуса.

//!_IC_2
sp=inparam("PERIOD",1,1000,20);
if c>o then xh=h-c;else xh=h-o;
if c>o then xl=o-l;else xl=c-l;
tsh=mov(xh,sp,s);
tsl=mov(xl,sp,s);
//покупка
if xl>2*tsl or (c-o)> 2*tsh
   or (xl>2*xh and xl>tsl) then br=3; else br=0;
if (o-c)>2*tsl then br=0;
//r;
//продажа
if xh>2*tsh or (o-c)> 2*tsl
   or (xh>2*xl and xh>tsh) then sr=-3; else sr=0;
if abs(xh-xl)<((tsh+tsl)/2)
   and abs (o-c)<((tsh+tsl)/2) then
begin br=0;
sr=0;
end;
if (c-o)>2*tsh then sr=0;
//дожи
d=(tsh-tsl);
d1=abs(xh-xl);
d2=abs(o-c);
if d2<=d and d1<=d then 
begin sr=0; br=0; end;
a=h;
b=ref(h,-1);
if a>b then h2=a; else h2=b;
a1=l;
b1=ref(l,-1);
if a1<b1 then l2=a1; else l2=b1;
o2=ref(o,-1);
c2=c;
//покупка
if c2>h2-(h2-l2)/3 then br2=1; else br2=0;
//r2;
//продажа
if c2<l2+(h2-l2)/3 then sr2=-1; else sr2=0;
zzz=sr2+br2+br+sr;
if zzz>0 then rr=zzz; else rr=0;
if zzz<0 then rr1=zzz; else rr1=0;
rr;
rr1;

Вот код для МТ4

 //+------------------------------------------------------------------+

//|                                                       !_IC_2.mq4 |
//|                                                   Nikolay Kobzar |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "Nikolay Kobzar"
#property link      "www.traderacademy.ru"

#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Blue

double rr[];
double rr1[];
double xh[];
double xl[];

extern int sp = 20;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   IndicatorShortName("!_IC_2");
   IndicatorBuffers(4);
   SetIndexBuffer(0,rr);
   SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,2);
   SetIndexLabel(0,"rr");
   SetIndexBuffer(1,rr1);
   SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID,2);
   SetIndexLabel(1,"rr1");   
   
   SetIndexBuffer(2,xh);
   SetIndexBuffer(3,xl);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();

   if (Bars <= sp) return(0);
   if (counted_bars < 0) return(-1);
   if (counted_bars > 0) counted_bars--;

   int loopbegin = Bars - counted_bars - 1;
   
   double tsh, tsl;    
   int i,j;
   int br,sr,br2,sr2,zzz;
   double d,d1,d2,a,b,h2,a1,b1,l2,c2,o2;
   
   for(i=loopbegin; i>=0; i--) {
     if (Close[i] > Open[i]) {
       xh[i] = High[i]-Close[i];
       xl[i] = Open[i]-Low[i]; }
     else {
       xh[i] = High[i]-Open[i];
       xl[i] = Close[i]-Low[i];}         
   }
       
   for(i=loopbegin; i>=0; i--) {
     tsh=0;
     tsl=0;
     for (j=0;j<sp;j++) {
       tsh = tsh + xh[i+j];
       tsl = tsl + xl[i+j];
     }   
     tsh = tsh / sp;
     tsl = tsl / sp;   
     
     if ( (xl[i]>2*tsl) || (Close[i]-Open[i]>2*tsh)
          || ((xl[i]>2*xh[i]) && (xl[i]>tsl)) ) br=3; else br=0;
     if ( (Open[i]-Close[i])>2*tsl ) br=0;
     
     if ( (xh[i]>2*tsl) || (Open[i]-Close[i]>2*tsl) 
          || (xh[i]>2*xl[i] && xh[i]>tsh) ) sr=-3; else sr=0;
     if ( (MathAbs(xh[i]-xl[i]) < ((tsh+tsl)/2)) 
          && (MathAbs(Open[i]-Close[i])<((tsh+tsl)/2)) ) { br=0; sr=0;}
     if ( (Close[i]-Open[i])>2*tsh ) sr=0;
     
     d = tsh-tsl;
     d1 = MathAbs(xh[i]-xl[i]);
     d2 = MathAbs(Open[i]-Close[i]);
     if ( (d2<=d) && (d1<=d) ) { sr=0; br=0; }
     
     a=High[i];
     b=High[i+1];
     if (a>b) h2=a; else h2=b;
     a1=Low[i];
     b1=Low[i+1];
     if (a1<b1) l2=a1; else l2=b1;
     o2=Open[i+1];
     c2=Close[i];
     
     if (c2 > h2-(h2-l2)/3) br2=1; else br2=0;
     
     if (c2 < l2+(h2-l2)/3) sr2=-1; else sr2=0;
     zzz=sr2+br2+br+sr;
     if (zzz>0) rr[i]=zzz; else rr[i]=0;
     if (zzz<0) rr1[i]=zzz; else rr1[i]=0; 
   }
//----

   return(0);
  }
//+---------

Respondido

1
Desenvolvedor 1
Classificação
(3)
Projetos
4
25%
Arbitragem
0
Expirado
0
Livre
2
Desenvolvedor 2
Classificação
Projetos
0
0%
Arbitragem
0
Expirado
0
Livre
3
Desenvolvedor 3
Classificação
(806)
Projetos
1379
72%
Arbitragem
113
28% / 48%
Expirado
343
25%
Trabalhando
Pedidos semelhantes
Technical task Make dashboard for several signals for choose for mt4 and mt5 with source code TimeFrames show (1m,5m,15m,30m,1h,4h,1d,7d,30d) For mt5 other TF (choose) Life time on current tf for live candle (back time to 0 before new) (true\false) Size Colour Symbols import from wathlist Signals for choose (only 1): 1)Current price into bb or ouside BB period, shift, std 2)Trend by MA MA period, shift, types 3)Price
Modify indicator Cycles 4 with rectangle Make indictor for mt4 and mt5 with comments in source code This indicator based on Cycles_4 Parametres MA1 - is default MA2 (yes or no) - yes - value add (if not 3 MA - 2nd in trend MA, also if only 1 MA without 2 and 3) Trend MA (true\false) - true - yes - value add Revers rect - true/false Fix rect by height - true\false, like how user add and this remember in the exit from

Informações sobre o projeto

Orçamento