This script applies the average of each major MA (SMA, RMA, EMA, WVMA, WMA) to the MACD formula.
The logic is simple. When all 5 MA's are in agreement in direction, then then script will notify users of change. I posted this as a strategy to help show how logic does in back test. If you use my simple yet effective solution to find take profit locations, you can blow this back testing out of the water!!!
long = ma > ma[1] and ma1 > ma1[1] and ma2 > ma2[1] and ma3 > ma3[1] and ma4 > ma4[1] short = ma < ma[1] and ma1 < ma1[1] and ma2 < ma2[1] and ma3 < ma3[1] and ma4 < ma4[1]
alertcondition(long == true, title='MACD LONG SIGNAL', message='MACD LONG!') alertcondition(short == true, title='MACD SHORT SIGNAL', message='MACD SHORT!')
Nota Keluaran
⋅
Sorry for the confusion. I stumbled upon good results thinking I was using MACD formula. Turns out I was only using partial formula.
The mistake just goes to show how uncomplicated a script needs to be to give good back testing results even on a line chart.
Nota Keluaran
⋅
Updated version with 4H setting at 66 just to show better backtest. See comment section below to test other lookback periods for other timeframes
I also changed overlay to true to save space on your screen
So 1st MACD calc should be:
ma = vwma(len1) - vwma(len2)
Craig_Claussen
⋅
@JustUncleL, Yes I apologize you are correct. I was so blinded by results that I didn't even realize I had only used only part of the formula for macd
Sometimes mistakes can be a good thing - like in this case.
SO this is essentially an average of the most common MA's ( SMA, RMA, EMA, WVMA, WMA). Which is quite funny when you take it all in. Something as simple as a multi-MA formula can create such positive backtest results
Using a lookback period of 598-599 will give same results as original script.
I will update now:
long = ma > ma[1] and ma1 > ma1[1] and ma2 > ma2[1] and ma3 > ma3[1] and ma4 > ma4[1]
short = ma < ma[1] and ma1 < ma1[1] and ma2 < ma2[1] and ma3 < ma3[1] and ma4 < ma4[1]
@Craig_Claussen, Great thanks for the correction. The results are good as a Multi-MA strategy in any case. In actual fact I found the corrected Multi-MA MACD does not perform as well as straight MAs. Like you said sometimes you find something useful by accident.
theheirophant
⋅
@Craig_Claussen, the results are not displayed correctly mate. You are buying more contracts than you have equity for. This inflates the profit percentages so so much. Its a huge bug.
Craig_Claussen
⋅
I had error in study format. I apologize about the delay fixing it
long = ma > ma[1] and ma1 > ma1[1] and ma2 > ma2[1] and ma3 > ma3[1] and ma4 > ma4[1] and ma5 > ma5[1] and ma6 > ma6[1]
short = ma < ma[1] and ma1 < ma1[1] and ma2 < ma2[1] and ma3 < ma3[1] and ma4 < ma4[1] and ma5 < ma5[1] and ma6 < ma6[1]
You mention "If you use my simple yet effective solution to find take profit locations" but I can't seem to find any reference to taking profit? Am I overlooking it? Thanks
Craig_Claussen
⋅
@XfalconX, I apologize I thought I posted the link to a private chart I published showing how to take profit
huh_
⋅
In the updated study, I only see the plotted lines, no shape. Is it possible for you to add a shape for the chart to the script?
Craig_Claussen
⋅
@huh_, Correct. Thanks for catching that. I updated study above
MACD = MA(Long Length) - MA(Short Length).
So I believe the 1st MACD result should be:
ma = vwma(len2) - vwma(len1)