DanielManahan
Member
I want to plot the count of the number of candles that a stock fails to break above all time highs such that each candle will have a plot point returning a value of zero if a new highest high is made and 1 if it fails, accumulating that count each candle that fails.
so if you look at QQQ as of 1/14/22 it should have a plot point value of 37 because for the last 37 stock trading days it has failed to break over 408.71 the latest highest high on the daily set on 11/22/22
if QQQ breaks over 408.71 the highest high, then the plot point resets to 0; if the next day it breaks again a new highest high then that too would have a plot point of zero.
this will be great to track certain instruments to see how long they take to let bag holders who top tick, cash out and break even.
I am still trying to research the syntax for controlling the count and how to implement Count = count +1;
I have the logic sketched out, I don't get the syntax.
declare lower;
declare once_per_bar;
input length = 252; #number of trading days in one year on the daily chart
def BreakOutTarget = Highest(high[1], length);
plot countFail = if high[0] < BreakOutTarget then countFail = countFail + 1, else 0;
# plots the number of days a stock fails to make a new yearly high on the daily chart. will reset the plot to 0 each day it makes a new high. and count up one point for each day it fails.
so if you look at QQQ as of 1/14/22 it should have a plot point value of 37 because for the last 37 stock trading days it has failed to break over 408.71 the latest highest high on the daily set on 11/22/22
if QQQ breaks over 408.71 the highest high, then the plot point resets to 0; if the next day it breaks again a new highest high then that too would have a plot point of zero.
this will be great to track certain instruments to see how long they take to let bag holders who top tick, cash out and break even.
I am still trying to research the syntax for controlling the count and how to implement Count = count +1;
I have the logic sketched out, I don't get the syntax.
declare lower;
declare once_per_bar;
input length = 252; #number of trading days in one year on the daily chart
def BreakOutTarget = Highest(high[1], length);
plot countFail = if high[0] < BreakOutTarget then countFail = countFail + 1, else 0;
# plots the number of days a stock fails to make a new yearly high on the daily chart. will reset the plot to 0 each day it makes a new high. and count up one point for each day it fails.