Cribbage
Member
I'm trying to study TFC on a few time frames. I would like a lower study with a zero line that shows a plot that gives a +1 when the specified time frame is green, -1 when red, 0 when neutral. I scraped some of the simple parts from PelonSax's brilliant suite of strat indicators to try to do it on my own thinking it would be simple.
The problem I'm running into is that it plots the price of the asset, rather than telling me if the condition is true or not. These seems like something I can normally bang out but I'm stymied. Thanks for any help.
The problem I'm running into is that it plots the price of the asset, rather than telling me if the condition is true or not. These seems like something I can normally bang out but I'm stymied. Thanks for any help.
Code:
##Cribbage 8/18/23 TFC Review, base code from Pelon Sax codes on Use Think Script
##https://usethinkscript.com/threads/indicator-for-think-or-swim-based-on-rob-smiths-the-strat.3312/
##Can't get it to work as simply +1 green / -1 red as it seems to use the value of the asset
declare lower;
input Time_Frame = AggregationPeriod.hour;
plot H = high(period = Time_Frame);
plot L = low(period = Time_Frame);
def O = open(period = Time_Frame);
def C = close(period = Time_Frame);
plot red = O<C;
plot green = O>C;
#plot zeroline = O;
#zeroline.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
#zeroline.SetLineWeight(2);
#plot Dir = green;
#plot dir = red or green;