I use this study but with my limited scripting experience was hoping for assistance/guidance in editing this TOS study and transforming it into a custom TOS watchlist script. I have tried adding inputs, changing def's, plots, addLabel, and assignBackgroundColor but have not been successful. It's currently beyond my capability. I'm trying to create a custom watchlist column from the study script below which assigns a "green" background color when the "triggerbuy" is indicated and a "red" background color when the "triggersell" is indicated.
Any assistance would be greatly appreciated!!!
Any assistance would be greatly appreciated!!!
Code:
input signalOffsetFactor = 0.20;
def signalOffset = AvgTrueRange(high,close,low,9)*signalOffsetFactor;plot Data = hlc3;
def triggerSell = if(if(close[-1] < high, 1, 0) and (hlc3[-2] < close[-1] or hlc3[-3] < close[-1]), 1, 0);
def triggerBuy = if(if(close[-1] > low, 1, 0) and (hlc3[-2] > close[-1] or hlc3[-3] > close[-1]), 1, 0);
rec buySellSwitch = if(triggerSell, 1, if(triggerBuy, 0, buySellSwitch[1]));
def thirdBarClosed = if(IsNaN(hlc3[-3]), 0, 1);
plot SBS = if(triggerSell and thirdBarClosed and !buySellSwitch[1], high+signaloffset, if(triggerBuy and thirdBarClosed and buySellSwitch[1],low-signaloffset, double.nan));
SBS.SetStyle(curve.FIRM);
SBS.SetPaintingStrategy(paintingStrategy.LINE_VS_POINTS);
SBS.SetLineWeight(2);
SBS.AssignValueColor(if triggerSell then
if thirdbarclosed then
#UpPos
CreateColor(255, 0, 0) else
#UpNeg
CreateColor(255, 0, 0)
else if Triggerbuy then
#DnPos
CreateColor(0, 255, 0) else
#DnNeg
CreateColor(0, 255, 0));
#Free thinkscript for the thinkorswim platform