Hi @mashume
I'd love to take this indicator and 'translate' it to NinjaTrader if you don't mind. In order for me to do so, can you please clarify the math behind it? here's what I learned from other replies in this thread, can you confirm or correct me please?
High level explanation of the process:
1. calculate the slope of a straight line between the value n bars ago and the previous bar
2. project a line on that slope from the previous bar
3. compare the value of the current bar HMA to the projected value
4. if the value from step 3 is negative, and the value from step 3 last time around was negative, there is no change of concavity. Otherwise, it has changed and a signal is generated.
Math:
def delta = HMA[1] - HMA[lookback + 1];
// ^ this line takes the 3rd from last calculated HMA value and subtracts it from last HMA value. so if HMA was [4,6,10], delta would be 6
def delta_per_bar = delta / lookback;
// ^ here we will take 6 and divide it by lookback (2). Our delta_per_bar here is 6/2 = 3
def next_bar = HMA[1] + delta_per_bar;
// ^ next HMA value (one we are predicting) is 10+3 = 13
def concavity = if HMA > next_bar then 1 else -1;
// ^The trick part of this comes by looking to see if the value of the HMA for the current bar is above or below the predicted (future projection of last HMA + the calculated slope as a change per bar. In the illustration, if the shaded region between the red dash and the black HMA is red, we're below the value predicted and the concavity is downward. If it's green, we're above the projected value and concavity is upward. The other calculations are simply to decide if the general trend is upward or downward (check the original image I sent for visual representation.
Have I missed any other calculation?
Thanks again, this indicator is amazing.
I'd love to take this indicator and 'translate' it to NinjaTrader if you don't mind. In order for me to do so, can you please clarify the math behind it? here's what I learned from other replies in this thread, can you confirm or correct me please?
High level explanation of the process:
1. calculate the slope of a straight line between the value n bars ago and the previous bar
2. project a line on that slope from the previous bar
3. compare the value of the current bar HMA to the projected value
4. if the value from step 3 is negative, and the value from step 3 last time around was negative, there is no change of concavity. Otherwise, it has changed and a signal is generated.
Math:
def delta = HMA[1] - HMA[lookback + 1];
// ^ this line takes the 3rd from last calculated HMA value and subtracts it from last HMA value. so if HMA was [4,6,10], delta would be 6
def delta_per_bar = delta / lookback;
// ^ here we will take 6 and divide it by lookback (2). Our delta_per_bar here is 6/2 = 3
def next_bar = HMA[1] + delta_per_bar;
// ^ next HMA value (one we are predicting) is 10+3 = 13
def concavity = if HMA > next_bar then 1 else -1;
// ^The trick part of this comes by looking to see if the value of the HMA for the current bar is above or below the predicted (future projection of last HMA + the calculated slope as a change per bar. In the illustration, if the shaded region between the red dash and the black HMA is red, we're below the value predicted and the concavity is downward. If it's green, we're above the projected value and concavity is upward. The other calculations are simply to decide if the general trend is upward or downward (check the original image I sent for visual representation.
Have I missed any other calculation?
Thanks again, this indicator is amazing.