Given the following:

Below is the previous code I was trying...The compiler didn't complain, but the code didn't interact with the studies either:

I've tried everything I can think of, searched here and across the internet, but I can't find the answer...Any help/pointers in the right direction would be greatly appreciated

Thanks in advance...

Code:

```
input mode = {default Value, Avg, Signal};
input mode_ma = {default Simple, Exponential, Weighted, Wilders, Hull, EHMA, THMA};
input ma_length = 55; #Length(180-200 for floating S/R , 55 for swing entry)
def MACD_Value;
def MACD_Avg;
def EMA_Signal;
switch (mode) {
case Value:
MACD_Value = g(length = fastLength) - g(length = slowLength);
case Avg:
MACD_Avg = g(price = Value, length = MACDLength);
case Signal:
EMA_Signal = EMA – AA * RE8;
}
def avg_MACD_Value;
def avg_MACD_Avg;
def avg_EMA_Signal;
switch (mode_ma) {
case Simple:
avg_MACD_Value = average(MACD_Value, ma_length);
avg_MACD_Avg = average(MACD_Avg, ma_length);
avg_EMA_Signal = average(EMA_Signal, ma_length);
case Exponential:
avg_MACD_Value = expaverage(MACD_Value, ma_length);
avg_MACD_Avg = expaverage(MACD_Avg, ma_length);
avg_EMA_Signal = expaverage(EMA_Signal, ma_length);
case Weighted:
avg_MACD_Value = wma(MACD_Value, ma_length);
avg_MACD_Avg = wma(MACD_Avg, ma_length);
avg_EMA_Signal = wma(EMA_Signal, ma_length);
case Wilders:
avg_MACD_Value = wildersaverage(MACD_Value, ma_length);
avg_MACD_Avg = wildersaverage(MACD_Avg, ma_length);
avg_EMA_Signal = wildersaverage(EMA_Signal, ma_length);
case Hull:
avg_MACD_Value = wma(2 * wma(MACD_Value, ma_length / 2) - wma(MACD_Value, ma_length), round(sqrt(ma_length)));
avg_MACD_Avg = wma(2 * wma(MACD_Avg, ma_length / 2) - wma(MACD_Avg, ma_length), round(sqrt(ma_length)));
avg_EMA_Signal = wma(2 * wma(EMA_Signal, ma_length / 2) - wma(EMA_Signal, ma_length), round(sqrt(ma_length)));
case EHMA:
avg_MACD_Value = expaverage(2 * expaverage(MACD_Value, ma_length / 2) - expaverage(MACD_Value, ma_length), round(sqrt(ma_length)));
avg_MACD_Avg = expaverage(2 * expaverage(MACD_Avg, ma_length / 2) - expaverage(MACD_Avg, ma_length), round(sqrt(ma_length)));
avg_EMA_Signal = expaverage(2 * expaverage(EMA_Signal, ma_length / 2) - expaverage(EMA_Signal, ma_length), round(sqrt(ma_length)));
case THMA:
avg_MACD_Value = wma(wma(MACD_Value,(ma_length/2) / 3) * 3 - wma(MACD_Value, (ma_length/2) / 2) - wma(MACD_Value, (ma_length/2)), (ma_length/2));
avg_MACD_Avg = wma(wma(MACD_Avg,(ma_length/2) / 3) * 3 - wma(MACD_Avg, (ma_length/2) / 2) - wma(MACD_Avg, (ma_length/2)), (ma_length/2));
avg_EMA_Signal = wma(wma(EMA_Signal,(ma_length/2) / 3) * 3 - wma(EMA_Signal, (ma_length/2) / 2) - wma(EMA_Signal, (ma_length/2)), (ma_length/2));
}
;
```

Below is the previous code I was trying...The compiler didn't complain, but the code didn't interact with the studies either:

Code:

```
input modeswitch = {default "Value", "Avg", "Diff", "Signal", "EMA"};
input modeSwitch_ma = {default "Simple", "Exponential", "Weighted", "Wilders", "Hull", "EHMA", "THMA"};
input ma_length = 55; #Length(180-200 for floating S/R , 55 for swing entry)
def ma_calc;
switch (modeSwitch) {
case "Value":
ma_calc = g(length = fastLength) - g(length = slowLength);
case "Avg":
ma_calc = g(price = Value, length = MACDLength);
case "Diff":
ma_calc = Value - Avg;
case "Signal":
ma_calc = EMA – AA * RE8;
case "EMA":
ma_calc = AA * Close + CC * EMA[1];
}
;
def multi_ma;
switch (modeSwitch_ma) {
case "Simple":
multi_ma = average(ma_calc, ma_length);
case "Exponential":
multi_ma = expaverage(ma_calc, ma_length);
case "Weighted":
multi_ma = wma(ma_calc, ma_length);
case "Wilders":
multi_ma = wildersaverage(ma_calc, ma_length);
case "Hull":
multi_ma = wma(2 * wma(ma_calc, ma_length / 2) - wma(ma_calc, ma_length), round(sqrt(ma_length)));
case "EHMA":
multi_ma = expaverage(2 * expaverage(ma_calc, ma_length / 2) - expaverage(ma_calc, ma_length), round(sqrt(ma_length)));
case "THMA":
multi_ma = wma(wma(ma_calc,(ma_length/2) / 3) * 3 - wma(ma_calc, (ma_length/2) / 2) - wma(ma_calc, (ma_length/2)), (ma_length/2));
}
;
```

I've tried everything I can think of, searched here and across the internet, but I can't find the answer...Any help/pointers in the right direction would be greatly appreciated

Thanks in advance...

Last edited by a moderator: