English

A question about Indicator Lines displaying

 54 saji 2015.02.07 16:17   Hello,All:I just finish a trendline indicator. The logic is quite simple:I make a judgement of the current market trendcondition( up or down ) ;then if it's UP, the line value is current bar's LOW;if it's DOWN, the  line value is current bar's HIGH;AND i want to use different color for it's trendline display, just like the HMA line below:but what i got is below:  You can see that the trendline is not continous when the trendcondition change!the code for trendline value is below: ```      if(TrendCondition[shift] == 1)       {          HighBuffer[shift] = 0;          LowBuffer[shift] = Low[shift];       }       else if(TrendCondition[shift] == 2)       {          HighBuffer[shift] = High[shift];          LowBuffer[shift] = 0;       }```And I have check the relevant code of HMA indicator, it use the same logic......Can anyone help? saji
 108 eddie 2015.02.07 16:41 #   Hi saji!Your Indicator works as defined.You want two lines. One with hights and one wits lows. Thats what you got.You have to specify what shall be done, if the trend changes. And then implement it.eddie
 735 honest_knave 2015.02.07 17:04 #   Hello saji,Whenever you get a change in trend, both HighBuffer and LowBuffer will need the same value. That way you will have a continuous line.
12985
WHRoeder 2015.02.07 20:40 #

honest_knave: Whenever you get a change in trend, both HighBuffer and LowBuffer will need the same value. That way you will have a continuous line.
 ```     if(TrendCondition[shift] == 1)       {          HighBuffer[shift] = 0;          LowBuffer[shift] = Low[shift];       } ``` ```     if(TrendCondition[shift] == 1)       {          HighBuffer[shift] = HighBuffer[shift+1] != 0 ? Low[shift] : 0;          LowBuffer[shift] = Low[shift];       } ```

54
saji 2015.02.08 07:00 #

honest_knave:

Hello saji,

Whenever you get a change in trend, both HighBuffer and LowBuffer will need the same value. That way you will have a continuous line.

WHRoeder:

thank you, guys

it's exactly what you say! After I change my code, i got the right result:

the code is below:

```      //------TrendLine Value Calculation
if(TrendCondition[shift] == 1)
{
if(TrendCondition[shift+1] == 1)    //UpWard
{
HighBuffer[shift] = 0;
LowBuffer[shift] = Low[shift];
}
else if(TrendCondition[shift+1] == 2)     //DownWard to UpWard
{
HighBuffer[shift] = Low[shift];
LowBuffer[shift] = Low[shift];
}
}
else if(TrendCondition[shift] == 2)
{
if(TrendCondition[shift+1] == 2)    //DownWard
{
HighBuffer[shift] = High[shift];
LowBuffer[shift] = 0;
}
else if(TrendCondition[shift+1] == 1)     //UpWard to DownWard
{
HighBuffer[shift] = High[shift];
LowBuffer[shift] = High[shift];
}
}      ```

 1211 deysmacro 2015.02.08 07:26 #   Most probably will repaint when the value changes.