Dear Sir,
is it possible inside the code to have a function that understands if the indicator is based on a daily chart or a 1-hour chart ?
Yes, this code snippet will return the minutes quantity of the current timeframe:
once NbBar = 1
//if BarIndex < NbBar+2 then
MyDay=openday
dayminutes = 1440*(MyDay-MyDay[1])
MyHour=openhour
hourminutes = 60*(MyHour-MyHour[1])
MyMin=openminute
barminutes = MyMin - MyMin[1] + hourminutes + dayminutes
barminutes=abs(barminutes)
Mybarminutes = lowest[NbBar](barminutes)[1]
//endif
return Mybarminutes as "Timeframe"
I don’t remember who post this snippet initially, but thanks to him.