crscrs85
Member
i found a cumulative tick indicator that counts from market open to close (930-1600). I am trying to modify it to include pre and post market as well but it wont plot anything when i change the times to 400 and 2000.
I am also trying to modify it from a line to histo which i did successfully with green bars for values above zero and red below zero but i want to add dark green and dark red for increasing and decreasing values. If the hashtag is removed from line 15 the code works fine. All the DIFF is code i copied and pasted from the MACD for reference as i tried to modify it myself and line 17 is what i was working on to add the color to increasing or decreasing values.
thanks
# credit https://tosindicators.com/indicators/cumulative-tick
declare lower;
def newday = GetDay() != GetDay()[1];
def tickData = hlc3(symbol = "$TICK");
addlabel(yes, tickData, color.white);
#all time inputs are based off eastern standard time in TOS
def cumulativeTickValue = if SecondsTillTime(930) < 0 and SecondsTillTime(1600) > 0 then tickData + cumulativeTickValue[1] else 0;
plot cumulativeTickplot = if cumulativeTickValue != 0 then cumulativeTickValue else Double.NaN;
cumulativeTickplot.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
#cumulativeTickPlot.AssignValueColor(if cumulativeTickPlot > 0 then color.green else color.red);
#cumulativeTickplot.AssignValueColor(if cumulativeTickplot > 0 and cumulativeTickPlot > #cumulativeTickPlot[1] then color.green else if cumulativeTickplot > 0 then color.Dark_green if #cumulativeTickPlot < 0 and cumulativeTickplot < cumulativetickplot[1] then color.Dark.red if #culmulativeTickplot < 0 color.red
#Diff.SetDefaultColor(GetColor(5));
#Diff.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
#Diff.SetLineWeight(3);
#Diff.DefineColor("Positive and Up", Color.GREEN);
#Diff.DefineColor("Positive and Down", Color.Dark_GREEN);
#Diff.DefineColor("Negative and Down", Color.RED);
#Diff.DefineColor("Negative and Up", Color.Dark_RED);
#Diff.AssignValueColor(if Diff >= 0 then if Diff > Diff[1] then Diff.color("Positive and Up") else #Diff.color("Positive and Down") else if Diff < Diff[1] then Diff.color("Negative and Down") else #Diff.color("Negative and Up"));
AddVerticalLine(newday, "", Color.GRAY, Curve.SHORT_DASH);
I am also trying to modify it from a line to histo which i did successfully with green bars for values above zero and red below zero but i want to add dark green and dark red for increasing and decreasing values. If the hashtag is removed from line 15 the code works fine. All the DIFF is code i copied and pasted from the MACD for reference as i tried to modify it myself and line 17 is what i was working on to add the color to increasing or decreasing values.
thanks
# credit https://tosindicators.com/indicators/cumulative-tick
declare lower;
def newday = GetDay() != GetDay()[1];
def tickData = hlc3(symbol = "$TICK");
addlabel(yes, tickData, color.white);
#all time inputs are based off eastern standard time in TOS
def cumulativeTickValue = if SecondsTillTime(930) < 0 and SecondsTillTime(1600) > 0 then tickData + cumulativeTickValue[1] else 0;
plot cumulativeTickplot = if cumulativeTickValue != 0 then cumulativeTickValue else Double.NaN;
cumulativeTickplot.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
#cumulativeTickPlot.AssignValueColor(if cumulativeTickPlot > 0 then color.green else color.red);
#cumulativeTickplot.AssignValueColor(if cumulativeTickplot > 0 and cumulativeTickPlot > #cumulativeTickPlot[1] then color.green else if cumulativeTickplot > 0 then color.Dark_green if #cumulativeTickPlot < 0 and cumulativeTickplot < cumulativetickplot[1] then color.Dark.red if #culmulativeTickplot < 0 color.red
#Diff.SetDefaultColor(GetColor(5));
#Diff.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
#Diff.SetLineWeight(3);
#Diff.DefineColor("Positive and Up", Color.GREEN);
#Diff.DefineColor("Positive and Down", Color.Dark_GREEN);
#Diff.DefineColor("Negative and Down", Color.RED);
#Diff.DefineColor("Negative and Up", Color.Dark_RED);
#Diff.AssignValueColor(if Diff >= 0 then if Diff > Diff[1] then Diff.color("Positive and Up") else #Diff.color("Positive and Down") else if Diff < Diff[1] then Diff.color("Negative and Down") else #Diff.color("Negative and Up"));
AddVerticalLine(newday, "", Color.GRAY, Curve.SHORT_DASH);