new_spy123
New member
What I am trying to do is setup a scanner custom filter that alerts me when 150 daily EMA is breached on the hourly chart. For this, I wrote the below script:
I set aggregation to 1h on the filter but then it says, Secondary Aggregation period not allowed: DAY. Refer to the below screenshot.
Interestingly, if I chart aggregation to Daily (D), error goes away but I doubt it will work as I am not sure how we can reference hourly data on Daily chart. Refer to the below screenshot
What am I missing here? I have gone through the documentation on secondary aggregation and the only thing I see is that we cannot reference smaller period than chart time period but in this case, it seems inverse.
Ruby:
# Alert when 150 daily ema is breached on the hourly chart
input aggHourly = AggregationPeriod.HOUR;
input aggDaily = AggregationPeriod.DAY;
input lengthDaily = 150;
plot expAvgDaily = ExpAverage( close( period = aggDaily), lengthDaily );
# true when close is between both lines
def condMet = close(period = aggHourly) < expAvgDaily;
Alert(condMet, "150 daily ema breached on the hourly chart", alert.once, Sound.ding);
I set aggregation to 1h on the filter but then it says, Secondary Aggregation period not allowed: DAY. Refer to the below screenshot.
Interestingly, if I chart aggregation to Daily (D), error goes away but I doubt it will work as I am not sure how we can reference hourly data on Daily chart. Refer to the below screenshot
What am I missing here? I have gone through the documentation on secondary aggregation and the only thing I see is that we cannot reference smaller period than chart time period but in this case, it seems inverse.