Svrz Nice chart. If you dont mind, what indicators/parameters trigger the red and green highlighting? Seems quite sound.
Hi Nzbryant I apologize for the late reply as I was out of town. The triggers are the following: 1) If either VXO or VIX hit the bottom band, then we have a short. 2) if MACD(5,13,6) XOVER is bearish, then we also have a short for this indicator. If both indicators are short, then the chart is red. If one is short and the other is long, then we have purple which seems to indicate that the previous trend will continue but perhaps at a slower pace. The opposite applies during the bull markets. If you have access to WL, I can post the code. Let me know. Regards
Hello srvz, I would really appreciate if you could post the code. I have a wealthlab account, but still some trouble with the coding language. Thanks in advance, taiko50
This uses VOX and MACD : ----------------------------------- {$I 'paintMacdPane'} HideVolume; var Bar: integer; var VXO : integer = GetExternalSeries('VXO.X', #close); var VXOUBB : integer = BBandUpperSeries(VXO, 20, 2); var VXOLBB : integer = BBandLowerSeries(VXO, 20, 2); var VXOPane : integer = CreatePane(60, false, true); var macdPane : integer = CreatePane(60, false, true); paintMacdPane(5,13,6, #close,macdPane, 1); PlotSeriesLabel(VXO, VXOPane, #black, #thin, 'VXO'); PlotSeriesLabel(VXOUBB, VXOPane, #red, #thin, 'UBB(20,2)'); PlotSeriesLabel(VXOLBB, VXOPane, #blue, #thin, 'LBB(20,2)'); var DiffVXOLBB : integer = SubtractSeries(VXO, VXOLBB); var Color, MacdColor : integer; var MACDH : integer = SubtractSeries(EMASeries(#close, 5), EMASeries(#close, 13)); var Signal : integer = EMASeries(MACDH, 6); for Bar := 20 to BarCount - 1 do begin if (@VXO[Bar] >= @VXOUBB[Bar]) then Color := 1 else if (@DiffVXOLBB[Bar] <=0.09) then Color := 0; if (@MACDH[Bar] > @Signal[Bar]) then MacdColor := 1 else if (@MACDH[Bar] < @Signal[Bar]) then MacdColor := 0; if ((Color = 0) and (MacdColor = 0)) then SetBackgroundColor(Bar, #RedBkg) else if ((Color = 1) and (MacdColor = 1)) then SetBackgroundColor(Bar, #GreenBkg) else if ((Color = 0) and (MacdColor = 1)) then SetBackgroundColor(Bar, #BlueBkg) else if ((Color = 1) and (MacdColor = 0)) then SetBackgroundColor(Bar, #BlueBkg); end;
From my limited observation, it seems that VIX is pretty good at showing the tops but not the bottoms. If VIX or VOX touches the bands, then that's a signal. Some of you folks may want to play with using VIX for tops and VOX for bottoms. ----------------- {$I 'paintMacdPane'} HideVolume; var Bar: integer; var VXO : integer = GetExternalSeries('VXO.X', #close); var VXOUBB : integer = BBandUpperSeries(VXO, 20, 2); var VXOLBB : integer = BBandLowerSeries(VXO, 20, 2); var VIX : integer = GetExternalSeries('VIX.X', #close); var VIXUBB : integer = BBandUpperSeries(VIX, 20, 2); var VIXLBB : integer = BBandLowerSeries(VIX, 20, 2); var vixPane : integer = CreatePane(60, false, true); var vxoPane : integer = CreatePane(60, false, true); var macdPane : integer = CreatePane(60, false, true); paintMacdPane(5,13,6, #close,macdPane, 1); PlotSeriesLabel(VXO, vxoPane, #black, #thin, 'VXO'); PlotSeriesLabel(VXOUBB, vxoPane, #red, #thin, 'UBB(20,2)'); PlotSeriesLabel(VXOLBB, vxoPane, #blue, #thin, 'LBB(20,2)'); PlotSeriesLabel(VIX, vixPane, #black, #thin, 'VIX'); PlotSeriesLabel(VIXUBB, vixPane, #red, #thin, 'UBB(20,2)'); PlotSeriesLabel(VIXLBB, vixPane, #blue, #thin, 'LBB(20,2)'); var DiffVXOLBB : integer = SubtractSeries(VXO, VXOLBB); var DiffVIXLBB : integer = SubtractSeries(VIX, VIXLBB); var Color, MacdColor : integer; var MACDH : integer = SubtractSeries(EMASeries(#close, 5), EMASeries(#close, 13)); var Signal : integer = EMASeries(MACDH, 6); var bVXOU, bVIXU, bVXOL, bVIXL : boolean; for Bar := 20 to BarCount - 1 do begin if (@VXO[Bar] >= @VXOUBB[Bar]) then bVXOU := true else bVXOU := false; if (@VIX[Bar] >= @VIXUBB[Bar]) then bVIXU := true else bVIXU := false; if (@DiffVXOLBB[Bar] <= 0.09) then bVXOL := true else bVXOL := false; if (@DiffVIXLBB[Bar] <= 0.09) then bVIXL := true else bVIXL := false; if ((@VXO[Bar] = @VXOUBB[Bar]) and (@VXO[Bar] = @VXOLBB[Bar])) then begin bVXOU := false; bVXOL := false; end; if (bVXOU or bVIXU) then color := 1 else if (bVXOL or bVIXL) then color := 0; if (@MACDH[Bar] > @Signal[Bar]) then MacdColor := 0 else if (@MACDH[Bar] < @Signal[Bar]) then MacdColor := 1; if ((Color = 0) and (MacdColor = 0)) then SetBackgroundColor(Bar, #RedBkg) else if ((Color = 1) and (MacdColor = 1)) then SetBackgroundColor(Bar, #BlueBkg) else if ((Color = 0) and (MacdColor = 1)) then SetBackgroundColor(Bar, #BlueBkg) else if ((Color = 1) and (MacdColor = 0)) then SetBackgroundColor(Bar, #GreenBkg); end;
Here is the paintMacdPane: ------------------------- {$I 'MACDEx'} procedure paintMacdPane(period1 : integer; period2 : integer; smoothPeriod : integer; price : integer; MacdPane : integer; tick : float); begin var Bar : integer; var MCD : integer = MACDExSeries(price, period1, period2); var Trig : integer = EMASeries(MCD,smoothPeriod); var Histo : integer = SubtractSeriesvalue(MCD, 0); var MACDNeutral : boolean; DrawHorzLine(0.0, MacdPane, #black, #solid); PlotSeriesLabel(MCD, MacdPane, #blue, #thin, 'MACD(5,13,6)'); PlotSeries(Trig, MacdPane, #red, #thin); PlotSeries(Histo, MacdPane, #black, #thickhist); DrawHorzLine(2*tick, MacdPane, #blue, #thin); DrawHorzLine(4*tick, MacdPane, #blue, #thin); DrawHorzLine(-2*tick, MacdPane, #red, #thin); DrawHorzLine(-4*tick, MacdPane, #red, #thick); for Bar := 0 to BarCount - 1 do begin if ((@Histo[Bar] < 2*tick) and (@Histo[Bar] > -2*tick)) then MACDNeutral := true else MACDNeutral := false; if ((@MCD[Bar] > @Trig[Bar]) and (@Histo[Bar] > 0) and (not MACDNeutral)) then begin SetSeriesBarColor( Bar, Histo, #Blue ) ; SetPaneBackgroundColor(Bar, MacdPane,#GreenBkg); end else if ((@MCD[Bar] > @Trig[Bar]) and (@Histo[Bar] < 0) and (not MACDNeutral)) then begin SetSeriesBarColor( Bar, Histo, #Gray) ; SetPaneBackgroundColor(Bar, MacdPane,#GreenBkg); end else if ((@MCD[Bar] < @Trig[Bar]) and (@Histo[Bar] < 0) and (not MACDNeutral)) then begin SetSeriesBarColor( Bar, Histo, #Red) ; SetPaneBackgroundColor(Bar, MacdPane,#RedBkg); end else if ((@MCD[Bar] < @Trig[Bar]) and (@Histo[Bar] > 0) and (not MACDNeutral)) then begin SetSeriesBarColor( Bar, Histo, #Gray ); SetPaneBackgroundColor(Bar, MacdPane,#RedBkg); end; end; end;
The VIX.X and VOX.X symbols used in the code, are only valid for Quote.Com/QCharts service. If you plan on using Yahoo or some other service, then you need to find out the correct symbols and make the simple changes in the code.
Thanks svrz. The only problem is I have now defined my system more clearly so loathe to introduce new elements! Have you tested the simple MACD 5/13/6 crossover for expectancy? I recall you saying its the best indicator you have found.