How can I avoid drawing line from Long to Short Change in Super Trend Indicator

 

Hi All

I have created custom iSuperTrend and want to remove the line which is drawn when trend changes. The attached screenshot will explain it better.

SuperTrend

    PlotIndexSetString(_BufferSuperTrend,PLOT_LABEL,"ST Fast ("+IntegerToString(ATRPeriod)+","+DoubleToString(ATRMultiple,2)+")");
    PlotIndexSetInteger(_BufferSuperTrend,PLOT_DRAW_TYPE,DRAW_COLOR_LINE);
    PlotIndexSetInteger(_BufferSuperTrend,PLOT_LINE_STYLE,STYLE_SOLID);
    //PlotIndexSetInteger(_BufferSuperTrend,PLOT_LINE_COLOR,clrLimeGreen,clrOrangeRed);
    PlotIndexSetInteger(_BufferSuperTrend,PLOT_LINE_WIDTH,2);
    PlotIndexSetDouble(_BufferSuperTrend,PLOT_EMPTY_VALUE,EMPTY_VALUE);

This the code I have used for drawing the line.

Hope to hear soon for a possible solution.

 

Your code is not helpful in correcting the problem.

https://www.mql5.com/en/code/16774

I will use this "super_trend_hull.mq5" to explain.

#property indicator_color1  clrLimeGreen,clrPaleVioletRed,clrNONE
.
.
.
 if (Direction[i]== 1) colorBuffer[i] = 0;
 if (Direction[i]==-1) colorBuffer[i] = 1;
 if (Direction[i] != Direction[i - 1]) colorBuffer[i] = 2;



Super Trend Hull Indicator
Super Trend Hull Indicator
  • www.mql5.com
Super trend indicator that uses hull average for calculation.
 
Nagisa Unada #:

Your code is not helpful in correcting the problem.

https://www.mql5.com/en/code/16774

I will use this "super_trend_hull.mq5" to explain.



Thanks Nagisa

The default ATR Multiplier in Super_Trend_Hull is 0.66, however when I changed it to 2.50 and 1.75 for two different settings, it also show the lines portion, which I wanted to remove.

Thanks again however, as I learned about Hull MA today :)

 
The problem can only be solved on the basis of  the curve calculation in OnCalculate. You have to look why it changes the sides up and down.
 
Tobias Johannes Zimmer #:
The problem can only be solved on the basis of  the curve calculation in OnCalculate. You have to look why it changes the sides up and down.

Thanks Tobias

Seems too much technical for me now.

Will survive the way it looks.

 
Anil Varma #:

The default ATR Multiplier in Super_Trend_Hull is 0.66, however when I changed it to 2.50 and 1.75 for two different settings, it also show the lines portion, which I wanted to remove.

Did you try this with a program like this? Or did this happen when atrMultiplier was 1.75 or 2.5?

 //Up[i]  =  mprice + atrMultiplier * atr;
 //Dn[i]  =  mprice - atrMultiplier * atr;
 Up[i]  = mprice + 2.5  * atr;
 Dn[i]  = mprice - 1.75 * atr;

I have tried  everything and could not reproduce it. It works without any problems.

 
Nagisa Unada #:

Did you try this with a program like this? Or did this happen when atrMultiplier was 1.75 or 2.5?

I have tried  everything and could not reproduce it. It works without any problems.

@Nagisa Unada

Hi Nagisha

Thanks for reply and efforts.

I have created two separate instance with different parameter SuperTrendSlow(Period 21 / 2.50 Multiple) and SuperTrendFast(Period 13 / 1.75 Multiple). At default setting STHull remain too close to prices and make impossible to code like TAG TO SUPER TREND for an Entry or Exit conditions. Then I am already using Keltner's Channel with ATR Multiple 1.75 and Double Bollinger Bands for identifying SQUEEZE, so the setting of (21/ 1.75) goes together with it well.

With this those lines when trend change, still remains there. The tutorials for SuperTrend I have watched recommend higher ATR Setting (subject to Optimization), however that is for SuperTrend and not SuperTrendHull Indicator. I might need to explore the difference in both type further.

Super Trend

SuperTrendHull with (13,Median,21,2.5) settings.

SuperTrendHull

SORRY ignore the screen shot below, it is for Super Trend and NOT FOR SuperTrendHull ... (I could not find how to delete it)

Lines

Reason: