So I came up with the attached script which works well on a Day timeframe. My question is can I use this on a 12 Hour period instead of a Day. I search all over and I couldn't find the answer.
Thanks
input timeFrame = AggregationPeriod.DAY;
input maLengthOne = 20;
input maTypeOne = AverageType.HULL;
def maOne = MovingAverage(maTypeOne, close(period = timeFrame), maLengthOne);
rec trackDirection = if maOne > maOne[1] then 1 else -1;
AddLabel(yes, "D-HMA", if trackDirection > 0 then Color.GREEN else Color.RED);
Thanks
input timeFrame = AggregationPeriod.DAY;
input maLengthOne = 20;
input maTypeOne = AverageType.HULL;
def maOne = MovingAverage(maTypeOne, close(period = timeFrame), maLengthOne);
rec trackDirection = if maOne > maOne[1] then 1 else -1;
AddLabel(yes, "D-HMA", if trackDirection > 0 then Color.GREEN else Color.RED);