Hi all,
I'm trying to compare the TTM_Wave()."Wave1" to the MACD()."Value" and need to find a common denominator. I've been trying to formulate them as a % of their ranges but I'm not getting the results I'd hoped. I've included the code below - I have it displaying a chart bubble so I can compare value but the final version would simply be an arrow and/or an alert. I can see the result I want when I merge the MACD and TTM_WAVE on the desktop app so I've included a pic of that to help illustrate the event I'm trying to identify:
For additional clarity, I have the TTM_Wave1 shown as a line instead of histogram - it's the blue line on the lower portion.

I'm trying to compare the TTM_Wave()."Wave1" to the MACD()."Value" and need to find a common denominator. I've been trying to formulate them as a % of their ranges but I'm not getting the results I'd hoped. I've included the code below - I have it displaying a chart bubble so I can compare value but the final version would simply be an arrow and/or an alert. I can see the result I want when I merge the MACD and TTM_WAVE on the desktop app so I've included a pic of that to help illustrate the event I'm trying to identify:
For additional clarity, I have the TTM_Wave1 shown as a line instead of histogram - it's the blue line on the lower portion.
Code:
#MACD Ratio
def M_Range = Highest(MACD()."Value") - Lowest(MACD()."Value");
Def M_Cur = MACD()."Value";
def M_ratio = M_Cur/M_Range;
#TTM_Wave Ratio
Def T_Range = Highest(TTM_Wave()."Wave1") - Lowest(TTM_Wave()."Wave1");
Def T_Cur = TTM_Wave()."Wave1";
Def T_Ratio = T_cur/T_Range;
#if t_ratio crosses below M_ratio
Def breakdown = if T_Ratio[1] > M_Ratio[1] and T_Ratio < M_Ratio then 1 else 0;
AddChartBubble(Breakdown,close[1], "TTM = " + T_Ratio + " MACD = " + M_Ratio, color.orange, no);