Traders' Tip text
This month's issue promises an interesting new take on relative strength as presented in the article by Mr. Katsanos. Author believes that his new creature, the
RSMK indicator, offers many improvements such as: simple and objective interpretation, possibility to rank symbols, less lag than the usual RS indicator etc.
Enclosed long-only trading system demonstrates how the RSMK can be put to use in both entries and different kind of exits:
Entry
- Buy next open when the RSMK crosses above zero
Exit
- Sell when the RSMK falls by a certain amount of indicator points (20) off its 20-day high
- Sell when the indicator crosses below its 20-day exponential moving average
- Sell when it crosses below zero
Mostly all parameters like periods and points are optimizable.
Figure 1. A Wealth-Lab 6 chart illustrating the application of the system's rules to a Daily chart of ALGN (Align Technology). The RSMK and its derivatives, a 40-day EMA and a level trailing 20 points off the recent 20-day peak, are plotted in the upper pane. (Data provided by Yahoo Finance)..
To execute the included trading system, Wealth-Lab users need to install (or update to) the latest version of the
TASCIndicators library from
our website or using the built-in
Extension Manager if they haven't already done so, and restart Wealth-Lab. Once the new indicator is listed under the TASC Magazine Indicators group it’s ready for use in Wealth-Lab.
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 TASCMar2020 : WealthScript
{
private StrategyParameter slider1;
private StrategyParameter slider2;
private StrategyParameter slider3;
private StrategyParameter slider4;
public TASCMar2020()
{
slider1 = CreateParameter("RSMK Period",90,50,130,10);
slider2 = CreateParameter("RSMK EMA Period",3,2,10,1);
slider3 = CreateParameter("Exit: off peak",20,10,40,10);
slider4 = CreateParameter("Exit: EMA period",20,10,50,10);
}
protected override void Execute()
{
string wlp = "WealthLabPro";
string app = System.Windows.Forms.Application.ProductName;
string indexName = app == wlp ? ".SPX" : "^GSPC"; //autodetect Fidelity / Yahoo symbol
var index = GetExternalSymbol(indexName, true).Close;
var rsmk = RSMK.Series(Close, index, slider1.ValueInt, slider2.ValueInt);
var rsmkEMA = EMAModern.Series(rsmk, slider4.ValueInt);
var offRecentPeak = Highest.Series(rsmk, 20) - slider3.Value;
string offPeak = string.Format("{0} pts off peak", slider3.Value);
string ema = string.Format("{0}-period EMA of RSMK", slider4.Value);
offRecentPeak.Description = offPeak; rsmkEMA.Description = ema;
for(int bar = GetTradingLoopStartBar(1); bar < Bars.Count; bar++)
{
if (IsLastPositionActive)
{
//sell when the indicator falls by a certain amount below its most recent peak
if( rsmk[bar] < offRecentPeak[bar] )
SellAtMarket(bar + 1, LastPosition, offPeak );
else
//sell when RSMK crosses below its moving average
if (CrossUnder(bar, rsmk, rsmkEMA))
SellAtMarket(bar + 1, LastPosition, "XU (EMA)");
else
//sell when RSMK crosses under zero
if (CrossUnder(bar, rsmk, 0))
SellAtMarket(bar + 1, LastPosition, "XU (0)");
}
else
{
//A buy signal is propagated when the indicator crosses over zero from below
if(CrossOver(bar, rsmk, 0))
BuyAtMarket(bar + 1);
}
}
ChartPane paneRSMK1 = CreatePane(30,true,true);
PlotSeries(paneRSMK1,rsmkEMA,Color.Red,LineStyle.Solid,1);
PlotSeries(paneRSMK1,offRecentPeak,Color.Blue,LineStyle.Dashed,2);
PlotSeries(paneRSMK1,rsmk,Color.DarkGreen,LineStyle.Histogram,3);
for (int bar = 1; bar < Bars.Count; bar++)
{
SetSeriesBarColor(bar, rsmk, rsmk[bar] > 0 ? Color.DarkGreen : Color.Red);
SetBackgroundColor(bar, rsmk[bar] > 0 ? Color.FromArgb(30, Color.Gray) : Color.Transparent);
}
HideVolume();
}
}
}
Gene Geren (Eugene)
Wealth-Lab team