And now for some exciting news...
After much debating with myself; I am not sure that I like the MACD aspect of this strategy. I have also been playing with the SuperTrend and I just overlayed it on top of this strategy. I think I am going to start working on a new strategy (will be a brand new post later on) which will rid the study of the MACD parameter and add the SuperTrend....if it works.
If any of the bright minds on here want to add it in you can just add this code to the bottom of the current strategy and let me know if you spot something, anything that would be of use. I personally think there will be better and much earlier entries.
I am also going to try to use much more visually appealing and easier to understand candle colors.
Stay tuned.
Code:
##################################################################
# SuperTrend #
##################################################################
def AtrMult = 5;
def nATR = 50;
input AvgType = AverageType.HULL;
def ATR = ATR("length" = nATR, "average type" = AvgType);
def UP_Band_Basic = HL2 + (AtrMult * ATR);
def LW_Band_Basic = HL2 + (-AtrMult * ATR);
def UP_Band = if ((UP_Band_Basic < UP_Band[1]) or (close[1] > UP_Band[1])) then UP_Band_Basic else UP_Band[1];
def LW_Band = if ((LW_Band_Basic > LW_Band[1]) or (close[1] < LW_Band[1])) then LW_Band_Basic else LW_Band[1];
def ST = if ((ST[1] == UP_Band[1]) and (close < UP_Band)) then UP_Band
else if ((ST[1] == UP_Band[1]) and (close > Up_Band)) then LW_Band
else if ((ST[1] == LW_Band[1]) and (close > LW_Band)) then LW_Band
else if ((ST[1] == LW_Band) and (close < LW_Band)) then UP_Band
else LW_Band;
plot Long = if close > ST then ST else Double.NaN;
Long.AssignValueColor(Color.GREEN);
Long.SetLineWeight(3);
plot Short = if close < ST then ST else Double.NaN;
Short.AssignValueColor(Color.RED);
Short.SetLineWeight(3);
def LongTrigger = isNaN(Long[1]) and !isNaN(Long);
def ShortTrigger = isNaN(Short[1]) and !isNaN(Short);
plot LongDot = if LongTrigger then ST else Double.NaN;
LongDot.SetPaintingStrategy(PaintingStrategy.POINTS);
LongDot.AssignValueColor(Color.GREEN);
LongDot.SetLineWeight(4);
plot ShortDot = if ShortTrigger then ST else Double.NaN;
ShortDot.SetPaintingStrategy(PaintingStrategy.POINTS);
ShortDot.AssignValueColor(Color.RED);
ShortDot.SetLineWeight(4);