Something interesting, old thread - page 117

 
Dragon:

I beg you to make this HISTO index by noon at the bottom

This indicator matches the averages that moves with candles 

This is the only code make it appear at the bottom as in the picture

please please 

 //------------------------------------------------------------------

#property copyright "mladen"
#property link      "mladen"
//------------------------------------------------------------------
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_plots   1
#property indicator_label1  "hull"
#property indicator_type1   DRAW_COLOR_LINE
#property indicator_color1  clrLimeGreen,clrOrange
#property indicator_style1  STYLE_SOLID
#property indicator_width1  2

//
//
//
//
//

enum enPrices
{
   pr_close,      // Close
   pr_open,       // Open
   pr_high,       // High
   pr_low,        // Low
   pr_median,     // Median
   pr_typical,    // Typical
   pr_weighted,   // Weighted
   pr_average     // Average (high+low+oprn+close)/4
};

input double   HmaLength =   14;     // Hull period
input double   HmaPower  =    1;     // Hull power
input enPrices Price     = pr_close; // Price

double hull[];
double colorInd[];

//------------------------------------------------------------------
//
//------------------------------------------------------------------
//
//
//
//
//

int OnInit()
{
   SetIndexBuffer(0,hull    ,INDICATOR_DATA); 
   SetIndexBuffer(1,colorInd,INDICATOR_COLOR_INDEX); 
   return(0);
}

//------------------------------------------------------------------
//
//------------------------------------------------------------------
//
//
//
//
//

int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime& time[],
                const double& open[],
                const double& high[],
                const double& low[],
                const double& close[],
                const long& tick_volume[],
                const long& volume[],
                const int& spread[])
{
   //
   //
   //
   //
   //
   
   int HalfPeriod = (int)MathFloor(HmaLength/2);
   int HullPeriod = (int)MathFloor(MathSqrt(HmaLength));
   for (int i=(int)MathMax(prev_calculated-1,1); i<rates_total; i++)
   {
      double price       = getPrice(Price,open,close,high,low,rates_total,i);
             hull[i]     = iLwmp(2.0*iLwmp(price,HalfPeriod,HmaPower,rates_total,i,0)-iLwmp(price,HmaLength,HmaPower,rates_total,i,1),HullPeriod,HmaPower,rates_total,i,2);
             colorInd[i] = colorInd[i-1];
               if (hull[i]>hull[i-1]) colorInd[i] = 0;
               if (hull[i]<hull[i-1]) colorInd[i] = 1;
   }
   return(rates_total);
}


//------------------------------------------------------------------
//                                                                  
//------------------------------------------------------------------
//
//
//
//
//

double getPrice(enPrices price, const double& open[], const double& close[], const double& high[], const double& low[], int bars, int i)
{
   switch (price)
   {
      case pr_close:     return(close[i]);
      case pr_open:      return(open[i]);
      case pr_high:      return(high[i]);
      case pr_low:       return(low[i]);
      case pr_median:    return((high[i]+low[i])/2.0);
      case pr_typical:   return((high[i]+low[i]+close[i])/3.0);
      case pr_weighted:  return((high[i]+low[i]+close[i]+close[i])/4.0);
      case pr_average:   return((high[i]+low[i]+close[i]+open[i])/4.0);
   }
   return(0);
}

//------------------------------------------------------------------
//                                                                 
//------------------------------------------------------------------
//
//
//
//
//

double workLwmp[][3];
double iLwmp(double price, double period, double power, int bars, int r, int instanceNo=0)
{
   if (ArrayRange(workLwmp,0)!= bars) ArrayResize(workLwmp,bars);
   
   //
   //
   //
   //
   //
   
   workLwmp[r][instanceNo] = price;
      double sumw = MathPow(period,power);
      double sum  = sumw*price;
      for(int k=1; k<period && (r-k)>=0; k++)
      {
         double weight = period-k;
                sumw  += MathPow(weight,power);
                sum   += MathPow(weight,power)*workLwmp[r-k][instanceNo];  
      }             
   return(sum/sumw);
}

Please did you read my previous post at all?

If not, please do.

 

Thank you, Mr 

I you convert this code

 

#property indicator_chart_window

#property indicator_buffers 3

#property indicator_plots   1


#property indicator_label1  "Label1"

#property indicator_type1   DRAW_COLOR_LINE

#property indicator_color1  DeepSkyBlue,PaleVioletRed

#property indicator_style1  STYLE_SOLID

#property indicator_width1  2 

 

To this code

 

#property indicator_separate_window

#property indicator_buffers 3

#property indicator_plots   1


#property indicator_label1  "Label1"

#property indicator_type1   DRAW_COLOR_HISTOGRAM

#property indicator_color1  DeepSkyBlue,PaleVioletRed

#property indicator_style1  STYLE_SOLID

#property indicator_width1  2

#property indicator_minimum 0

#property indicator_maximum 1 

 

The time frame is not working well

Do you help me with a simple amendment to the index until the time frame works well

When you select multiple time frame on the same index in the graph disappear  

This picture of the graph I want to work in this format

Index in two versions

 
Dragon:

Thank you, Mr 

I you convert this code

 

#property indicator_chart_window

#property indicator_buffers 3

#property indicator_plots   1


#property indicator_label1  "Label1"

#property indicator_type1   DRAW_COLOR_LINE

#property indicator_color1  DeepSkyBlue,PaleVioletRed

#property indicator_style1  STYLE_SOLID

#property indicator_width1  2 

 

To this code

 

#property indicator_separate_window

#property indicator_buffers 3

#property indicator_plots   1


#property indicator_label1  "Label1"

#property indicator_type1   DRAW_COLOR_HISTOGRAM

#property indicator_color1  DeepSkyBlue,PaleVioletRed

#property indicator_style1  STYLE_SOLID

#property indicator_width1  2

#property indicator_minimum 0

#property indicator_maximum 1 

 

The time frame is not working well

Do you help me with a simple amendment to the index until the time frame works well

When you select multiple time frame on the same index in the graph disappear  

This picture of the graph I want to work in this format

Index in two versions

Histo version of that averages (but be aware that it is a very old version - a lot have changed in averages since then)


 
Dragon:

Yes sir this is required

There is another problem you select multiple timeframe

Show only color on only the first frame

This picture of the graph

I have no such problem (here are 4 different time frames on my terminal)


 
mladen:

Histo version of that averages (but be aware that it is a very old version - a lot have changed in averages since then)


Yes sir this is required

There is another problem you select multiple timeframe

Show only color on only the first frame

This picture of the graph

Difference between mq4 and mq5 in the old version works timeframe either in the modern version framework did not work

Files:
averages.png  218 kb
mq4.JPG  148 kb
mq5.JPG  111 kb
 
Dragon:

Yes sir this is required

There is another problem you select multiple timeframe

Show only color on only the first frame

This picture of the graph

Difference between mq4 and mq5 in the old version works timeframe either in the modern version framework did not work

Try this

 
Dragon:

When you use a time-frame of the M5. M15, M30, H1

Same Averages

Time frame                     =     M5. M15, M30, H1

Apple to                          =       Close price

Calculation period            =          14

Calculation type               =       Hull MA

Multi color mode?            =        true

Interpolate mtf data ?      =       true

Chart shows this problem

No idea what are you doing, but when I do the same, this is what I get (and I used the hull, as you described, not the sma, as you have it on your picture, but it works the same for all averages in that set)


All is working just the way it should and there is no problem at all when I try to use it

All the best

 
mladen:

No idea what are you doing, but when I do the same, this is what I get (and I used the hull, as you described, not the sma, as you have it on your picture, but it works the same for all averages in that set)


All is working just the way it should and there is no problem at all when I try to use it

All the best

Thank you Thank you, Mr. index works well
Files:
mq5.JPG  122 kb
 
Dragon:
Thank you Thank you, Mr. index works well
Good. Happy trading :)
 

Thank you, God willing, Muwaffaq in your life

I have a request, if possible

Can macd_heatmap index turned into mq5 

This helps me to know the price movements on the rest of the couples

This indicator has a wonderful feature four colors

 Thank you sir

Files:
Reason: