TASC 2019-02 | The V-Trade Part 6 (Vervoort)

Modified on 2018/12/28 09:27 by Eugene — Categorized as: TASC Traders Tips

Traders' Tip text

The SVEStochRSI indicator created by Sylvain Vervoort is a price oscillator similar to StochRSI in its application and interpretation. Oscillating between 0 and 100, it becomes overbought after reaching 80 and oversold after dropping below 20. Author highlights its usage as a tool for confirming price reversals based on divergences between price and indicator.

The example WealthScript code can also be downloaded straight from Wealth-Lab ("Open Strategy", then "Download...") and includes a simple shorting Strategy which triggers and entry when the a) SVEStochRSI crosses under 70, and, b) price negatively diverges with the SVEStochRSI. A divergence detection routine focuses on the two indicator peaks just prior to the crossunder. The code compares the relative price peaks corresponding to the SVEStochRSI peak bars, and, if a negative divergence is detected the strategy draws in the divergence lines and initiates a short Position which is simply closed with a time-based exit.


Image

Figure 1. Example trades trades on QQQ.


After updating the TASCIndicators library to its latest version, the SVEStochRSI indicator can be found under the TASC Magazine Indicators group. You can plot it on a chart or use it as an entry or exit condition in a Rule-based Strategy without having to program a line of code yourself.

WealthScript Code (C#)

using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using WealthLab.Indicators;
using TASCIndicators;

namespace WealthLab.Strategies { public class SVEStochRSIDivergence : WealthScript { StrategyParameter rsiPeriod; StrategyParameter stoPeriod; StrategyParameter smaPeriod; public SVEStochRSIDivergence() { rsiPeriod = CreateParameter("SVEStochRSI Period", 21, 2, 200, 20); stoPeriod = CreateParameter("Stochastic Period", 8, 2, 200, 20); smaPeriod = CreateParameter("SVEStochRSI Period", 5, 2, 200, 20); }

protected override void Execute() { HideVolume(); DataSeries srsi = SVEStochRSI.Series(Close, rsiPeriod.ValueInt, stoPeriod.ValueInt, smaPeriod.ValueInt); ChartPane rsiPane = CreatePane(40, true, true); PlotSeries(rsiPane, srsi, Color.Red, LineStyle.Solid, 2); for (int bar = 3 * GetTradingLoopStartBar(srsi.FirstValidValue) ; bar < Bars.Count; bar++) { if (IsLastPositionActive) { Position p = LastPosition; if (bar + 1 - p.EntryBar > 6) ExitAtMarket(bar + 1, p, "Time-based"); } else if (CrossUnder(bar, srsi, 70)) { // check the last two SVEStochRSI peaks for negative divergence with price int pb1 = (int)PeakBar.Value(bar, srsi, 20, PeakTroughMode.Value); if (pb1 == -1) continue; int pb2 = (int)PeakBar.Value(pb1, srsi, 20, PeakTroughMode.Value); if (pb2 == -1) continue; if ( Math.Sign(srsi[pb1] - srsi[pb2]) == -1 && Math.Sign(High[pb1] - High[pb2]) == 1) { SetBackgroundColor(bar, Color.FromArgb(50, Color.Green)); DrawLine(rsiPane, pb2, srsi[pb2], pb1, srsi[pb1], Color.Blue, LineStyle.Solid, 2); DrawLine(PricePane, pb2, High[pb2], pb1, High[pb1], Color.Blue, LineStyle.Solid, 2); ShortAtMarket(bar + 1); } } } } } }