Coding help - page 631

 
mladen:

That is a repainting version of sidus indicator

Non repainting version can be downloaded from here : https://www.mql5.com/en/forum/180648/page293

Thanks 
 

@mladen, 

can u fix this indicator please ...

i must refresh chart every time ... thank you 

 

//+------------------------------------------------------------------+
//|                                                 pendingorder.mq4 |
//|                                                            Extra |
//|                                           pendingorder@gmail.com |
//+------------------------------------------------------------------+
#property copyright "pendingorder"
#property link      "pendingorder@gmail.com"

#property indicator_chart_window
#property indicator_buffers 5
#property indicator_color1 DarkTurquoise
#property indicator_color2 DarkTurquoise
#property indicator_color3 Crimson
#property indicator_color4 DarkTurquoise
#property indicator_color5 Red
#include <WinUser32.mqh>

extern int  History     =     1000;
extern int  Previous    =        0;
extern int  Bwidth      =        1;
extern int  Delay       =        1;
extern int  Equal       =        1;
bool Opti        =     true;
extern int  Atr         =      1; 

//--- buffers
double Buffer3[],Buffer4[],Buffer2[],Buffer1[],Buffer5[];
double win,win1=0,ck=0,cel=0,stp=0,ol,ol1,ok,ok1,ok2;
int cc=0,oeq,eq1,drw=1;
string wc,wii,wii1,wii2;
color col;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
  hWindow = WindowHandle( Symbol(), Period() );
  oldBars = iBars(NULL,RefreshPeriod);
//---- indicators
   SetIndexStyle(0,DRAW_ARROW,STYLE_SOLID,0);
   SetIndexArrow(0,234);
   SetIndexBuffer(0,Buffer1);
   
   SetIndexStyle(1,DRAW_ARROW,STYLE_SOLID,0);
   SetIndexArrow(1,233);
   SetIndexBuffer(1,Buffer2);
   
   
   SetIndexBuffer(2,Buffer3);
   SetIndexStyle(2,DRAW_NONE,STYLE_SOLID,0);
   SetIndexArrow(2,249);
   SetIndexBuffer(3,Buffer4);
   SetIndexStyle(3,DRAW_NONE,STYLE_SOLID,0);
   SetIndexArrow(3,249);
   SetIndexStyle(4,DRAW_NONE,STYLE_SOLID,2);
   SetIndexArrow(4,253);
   SetIndexBuffer(4,Buffer5);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
  ObjectsDeleteAll(0,OBJ_TEXT); 
  ObjectsDeleteAll(0,OBJ_ARROW);
  ObjectsDeleteAll(0,OBJ_LABEL);
    
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
 
  //logo();
  if(Opti==true){
  drw=0;
  eq1=1;
 while (eq1<=13)
 {
  opti();
  eq1++;}} 
  eq1=Equal;
  drw=1;
  opti();
  return(0);}
 
 int opti(){
 int Counted_bars=IndicatorCounted();
  int i,k,s=10;
  double x,x1,y,y1,z,z1,s1,s2,h1,h2,j1,j2,j3,j4,v,a,a1,b,b1,Now1;
  datetime tim1;
   i=Bars-Counted_bars-1;   
  if (i>History-1) 
  i=History-1;
 while(i>=0) 
 { 
   k=i+Previous;                                 
   x=Open[i];    
   
   x1=Open[i+1];   
   while(k>=0)
   {
   y=Open[k+1];   
   y1=Open[k];    
   if(x>=(y-Bwidth*Point) && x<y)z++;             
   if(x1<=y1+Bwidth*Point && x1>y1)z1++;
   k--;}//-----------------------------------------------------------------
   double atr=iATR(NULL,0,Atr,i);                
   if(z>eq1)s1=High[i]+atr;                   
   if(z1>eq1)s2=Low[i]-atr;                  
   if(s1==h1)j1++; else j1=0;                
   if(s2==h2)j2++; else j2=0;                  
   if(j1>Delay)Buffer3[i]=s1; else j3=0;       
   if(j2>Delay)Buffer4[i]=s2;else  j4=0;       
   //----------------------------------------------------------------------------------
   string text = DoubleToStr(s1,4), text1 = DoubleToStr(s2,4),TP,SL,TP1,SL1,Now;
   TP="TP "+DoubleToStr(b,3);
   TP1="TP "+DoubleToStr(a,3);
   SL=DoubleToStr(a1,3);
   SL1=DoubleToStr(a,3);
   //------------------------------------------------------------------------
   tim1 =iTime(NULL,0,i);
   Now= DoubleToStr(iMA(NULL,0,Bwidth,0,MODE_SMA,PRICE_MEDIAN,i),4);//
   //----------------------------------------------------------------------------------------------------------
   v=MathAbs(s1-s2);                                 
   a=Low[i]-v*Point;                       
   a1=Low[i]+v;                                      
   b=High[i]+v*Point;                     
   b1=High[i]-v;     
   
                                   
   //-------------------------------------------------------------
   if(Low[i+1]>s1 && Low[i+2]>s1 && j3==0 && s1 >Open[i+3]&&atr<Volume[i])
   //------------------------------------------------------------------------------------------------
   {Now1=(a+b)/2;win++;
   if(drw==1){
   Buffer1[i]=b;
   Buffer5[i]=b1;
   //ObjectCreate(Now,OBJ_ARROW,0,tim1,High[i] + 20 * Point,0,0);
   //ObjectSet(Now,OBJPROP_ARROWCODE,234);
   //ObjectSet(Now,OBJPROP_COLOR,White);
   ObjectCreate(text,OBJ_ARROW,0,tim1,High[i] + 50 * Point,0,0);
   ObjectSet(text,OBJPROP_ARROWCODE,5);
   ObjectSet(text,OBJPROP_COLOR,Crimson);
   ObjectCreate(SL1,OBJ_ARROW,0,tim1,High[i] + 50 * Point,0,0,0,0);
   ObjectSet(SL1,OBJPROP_ARROWCODE,5);
   ObjectSet(SL1,OBJPROP_COLOR,DarkTurquoise);
   }
   j3=1;cel=b;cc=1;stp=b1;
   }
   
   
   //------------------------------------------------------------------------------
   if(j2>2){if(High[i+1]<s2 && High[i+2]<s2 && j4==0&& s2<Open[i+3]&&atr<Volume[i])
   //--------------------------------------------------------------------------------------------------------
   {j4=1;win++;Now1=(a+b)/2;
   if(drw==1){
   Buffer2[i]=a;Buffer5[i]=a1;
   //ObjectCreate(Now,OBJ_ARROW,0,tim1,Low[i] - 20 * Point,0,0);
   //ObjectSet(Now,OBJPROP_ARROWCODE,233);
   //ObjectSet(Now,OBJPROP_COLOR,White);
   ObjectCreate(text1,OBJ_ARROW,0,tim1,Low[i] - 50 * Point,0,0);
   ObjectSet(text1,OBJPROP_ARROWCODE,5);
   ObjectSet(text1,OBJPROP_COLOR,Crimson);
   ObjectCreate(SL,OBJ_ARROW,0,tim1,Low[i] - 50 * Point,0,0);
   ObjectSet(SL,OBJPROP_ARROWCODE,5);
   ObjectSet(SL,OBJPROP_COLOR,DarkTurquoise);
   }
   cel=a;cc=1;stp=a1;}}
   z=0;z1=0;h1=s1;h2=s2; 
   
   if(High[i]>cel&&Low[i]<cel&&cc==1){win1++;cc=0;ok1=ok1+(MathAbs(cel-Now1)/Point);}
   i--;}                            
   return(0);}
   

return(0);}    
 
mladen:

morenokosta

That indicator us OK as is

No need to make any code change

Hello, Mladen. You can add this indicator parabolic_ziggy cubic regression, and regression in the following degrees, as is done, for example, the indicator I-regr?
And you can add the same degree of regression also in this indicator?
 
Garry119:
Hello, Mladen. You can add this indicator parabolic_ziggy cubic regression, and regression in the following degrees, as is done, for example, the indicator I-regr?
And you can add the same degree of regression also in this indicator?

Garry


Did you try using the _RegressionDegree parameter?

 

Dear mladen.

 

I wonder if it is possible to add shift to either of the averages in your Averages_ribbon 2_3 indicator. Would also look insane if one could paint the "cloud" between the averages.

Possible the regular arrow/alert code as well even if i dont find it that important. 

 

Thanks

 

 [img]https://i.gyazo.com/2f6531b03b3780114167e08a23873961.png[/img]

 

hello :)

I have a small request - could someone add please an option to set on how many bars back patterns will be shown (100, 500, etc.)? because on the RangeBar chart this indicator shows a lot of signals and it slows down my platform...

 

thank you very much :) 

Files:
Patterns.mq4  17 kb
 
freakout:

hello :)

I have a small request - could someone add please an option to set on how many bars back patterns will be shown (100, 500, etc.)? because on the RangeBar chart this indicator shows a lot of signals and it slows down my platform...

 

thank you very much :) 

freakout

Try it out now :

Files:
 

Hi Mladen, please help me with the filter of the image below.


 
kewu:

Hi Mladen, please help me with the filter of the image below.


Sorry but from that picture it could be anything. No way to know exactly what is it and what it is doing
 
NWFstudent:

Dear mladen.

 

I wonder if it is possible to add shift to either of the averages in your Averages_ribbon 2_3 indicator. Would also look insane if one could paint the "cloud" between the averages.

Possible the regular arrow/alert code as well even if i dont find it that important. 

 

Thanks

 

 [img]https://i.gyazo.com/2f6531b03b3780114167e08a23873961.png[/img]

NWFstudent

The problem is that we can not use filled areas as in metatrader 5 when using metatrader 4

Will post metatrader 5 version tomorrow and you shall see what are we missing in metatader 4

Reason: