I am building a watchlist column that show 20DSMA. Since, during the trading hours SMA changes, I want to show yesterday's SMA during RTH and actual ATH.
In order to find RTH I have used SecondsFromStart and SecondsTillEnd function i.e.
def rth = SecondsFromStart(930) > 0 and SecondsTillEnd (1600)> 0
This functions works as expected when I set the aggregation period for Watch Column to intraday. However that screwup my SMA calculation, which I do as below:
def sma = Average(close, 20);
This function now, will take candles/bars based on aggregation period. So for 5 mins, it will take 5 min candles. Whereas I want daily bars.
I tried with setting aggregation level at function level. Like this:
def sma = Average(close(period = "DAY"), 20);
I get NaN as results.
Obviously, I am doing something wrong. But my mind is not working. I would appreciate some help.
Thx,
In order to find RTH I have used SecondsFromStart and SecondsTillEnd function i.e.
def rth = SecondsFromStart(930) > 0 and SecondsTillEnd (1600)> 0
This functions works as expected when I set the aggregation period for Watch Column to intraday. However that screwup my SMA calculation, which I do as below:
def sma = Average(close, 20);
This function now, will take candles/bars based on aggregation period. So for 5 mins, it will take 5 min candles. Whereas I want daily bars.
I tried with setting aggregation level at function level. Like this:
def sma = Average(close(period = "DAY"), 20);
I get NaN as results.
Obviously, I am doing something wrong. But my mind is not working. I would appreciate some help.
Thx,