Cypress Tx
Experience: Intermediate
Platform: NinjaTrader ThinkorSwim
Trading: Stock Futures
Posts: 3 since Sep 2016
Thanks Given: 2
Thanks Received: 0
|
Hi all, I am new to coding on Think or swim. But trying to create a scan for stocks. I have got hand of how to create scan and add filters for stocks, studies. But I need another filter where I need to add ATR value for SPX into my scan. How do I add a custom field that will show ATR value of SPX?
I have tried below code but it does not calculate for SPX?
input symbol = "SPX";
declare upper;
input length = 9;
input price = close;
input ATR_Length = 14;
input Show_Labels = yes;
def ATR = hullMovingAvg(TrueRange(high(period = AggregationPeriod.DAY)[0], close(period = AggregationPeriod.DAY)[0], low(period = AggregationPeriod.DAY)[0]), ATR_Length);
#Def ATRRatio = ATR/100;
AddLabel(yes, AsText((ATR) / 100, NumberFormat.Three_DECIMAL_PLACES));
#plot myindicator = ATRRatio;
Please advice,
Thanks...Sunny
|