Im trying to make a script that uses the ttm_wave but i cant find the source code or a replaca. I have my own ttm_wave version, but its not exatcly like the original and well, im stuck. Would appreciate any advice or help, thanks.
Here is the exact TTM_Wave code from thinkorswim. It’s a combo of all the fib macds. Took me a month to figure this out because of all the misleading and incorrect information about how the TTM_wave works.
declare lower;
def macd1 = ExpAverage(close, 8) - ExpAverage(close, 34);
def macd2 = ExpAverage(close, 8) - ExpAverage(close, 55);
def macd3 = ExpAverage(close, 8) - ExpAverage(close, 89);
def macd4 = ExpAverage(close, 8) - ExpAverage(close, 144);
def macd5 = ExpAverage(close, 8) - ExpAverage(close, 233);
plot Wave1 = macd1;
Wave1.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Wave1.SetDefaultColor(Color.CYAN);
def w2high =
if macd1 >= macd2 and macd1 >= macd3 and macd1 >= macd4 and macd1 >= macd5 then macd1
else if macd2 >= macd1 and macd2 >= macd3 and macd2 >= macd4 and macd2 >= macd5 then macd2
else if macd3 >= macd1 and macd3 >= macd2 and macd3 >= macd4 and macd3 >= macd5 then macd3
else if macd4 >= macd1 and macd4 >= macd2 and macd4 >= macd3 and macd4 >= macd5 then macd4
else macd5;
def w2low =
if macd1 <= macd2 and macd1 <= macd3 and macd1 <= macd4 and macd1 <= macd5 then macd1
else if macd2 <= macd1 and macd2 <= macd3 and macd2 <= macd4 and macd2 <= macd5 then macd2
else if macd3 <= macd1 and macd3 <= macd2 and macd3 <= macd4 and macd3 <= macd5 then macd3
else if macd4 <= macd1 and macd4 <= macd2 and macd4 <= macd3 and macd4 <= macd5 then macd4
else macd5;
plot Wave2High = w2high;
Wave2High.SetDefaultColor(Color.GREEN);
Wave2High.SetLineWeight(2);
plot Wave2Low = w2low;
Wave2Low.SetDefaultColor(Color.RED);
Wave2Low.SetLineWeight(2);
plot ZeroLine = 0;
ZeroLine.SetDefaultColor(Color.GRAY);
ZeroLine.SetStyle(Curve.SHORT_DASH);