I have a strategy that needs to get triggers from indicators with different timeframes. In one case the 1 Day and the 3 Day. So a simple example is I need the trend direction on both the 1 Day and the 3 Day. If both meet my criteria then I send a trade signal (simple example, not my actual strategy). So if I'm on the 1 Day chart, getting the trend info form the 1 Day is easy. But I also need the trend info on the 3 Day.
So in a perfect world, I want to make the period an input to my indicator, with the default to use the period of the chart the indicator is on.
I imagine I want an overloaded indicator. For simplicity, lets assume its an SMA indicator. If I pass 1 parameter, then that parameter is the number of bars. if I pass 3 parameters, the first is the number of bars, and the 2nd is seconds, minutes, hours or days. the 3rd parameter is the number associated with the time period.
SMA(50,Minute,10) would get me the SMA info for the 50SMA on the 10 Minute chart.
SMA(50) would get me the SMA info for the 50SMA on whatever chart it was on.
But I only need to have all the indicator code once. It knows what bar data to use.
Is this possible?
Easy?
Any code out there that can get me started?
Any help is appreciated

Comment