Below is an example of what I am working with. I am new to thinkscript and doing my best to learn quickly. I am hoping to generate a stop loss line when my signal is triggered (similar to what is shown in the reversal indicator), however I do not want it to repaint. Any thoughts or suggestions to get me going in the right direction is very much appreciated.
Code:
#KELTNER
declare weak_volume_dependency;
input displace = 0;
input factor = 2.5;
input length = 20;
input price = open;
input averageType = AverageType.SIMPLE;
input trueRangeAverageType = AverageType.SIMPLE;
def shift = factor * MovingAverage(trueRangeAverageType, TrueRange(high, close, low), length);
def average = MovingAverage(averageType, price, length);
plot Avg = average[-displace];
Avg.SetDefaultColor(GetColor(1));
plot Upper_BandK1 = average[-displace] + shift[-displace];
Upper_BandK1.SetDefaultColor(GetColor(8));
plot Lower_BandK1 = average[-displace] - shift[-displace];
Lower_BandK1.SetDefaultColor(GetColor(5));
#def price1 = open [-1];
plot isBelow = price crosses below Upper_BandK1;
plot isAbove = price crosses above Lower_BandK1;
Last edited: