If a certain condition is met then the trend is up and the indicator plots 1, otherwise, if another condition is met the the trend is down and the indicator plots -1.
Following is the code:
if (CurrentBar < Barre1)
return;
if (Close[0] > MAX(High, Barre1)[1])
{
Plot0.Set(1);
}
if (Close[0] < MIN(Low, Barre1)[1])
{
Plot1.Set(-1);
}
The problem is that there are empty spaces but I'd like to have the previous value (1 or -1) until the trend does not change.
How can I write the code to plot the previous value and have a continuous indicator?
Thanks for any help.
Comment