TASC 2018-06 | A Technical Method For Rating Stocks (Katsanos)

Modified on 2018/04/30 07:33 by Eugene — Categorized as: TASC Traders Tips

Traders' Tip text

The idea of building a customized rating itself is not new but the good thing is that the software of today makes this technology available to every trader. The WealthScript code for Wealth-Lab for Markos Katsanos' rating technique is presented at the bottom. In it we've exposed the various parameters for optimization as well as for fine-tuning manually by dragging "parameter sliders" at the bottom left of the screen.

A backtest we performed on out-of-sample markets like German DAX30 second author's conclusions. The rating system effectively limits the amount of exposure to a bear market while still reaping a good profit with a better Recovery Factor and less market exposure.

Image

Figure 1. Here's how the rating technique avoids taking investing decisions in downtrends - as can be seen on this chart of GS (Goldman Sachs).

To execute the included trading system, Wealth-Lab users need to install (or update) the latest version of two indicator libraries, TASCIndicators and Community Indicators, from the Extensions section of our website and restart Wealth-Lab.

Image

Figure 2. For DAX stocks, the optimum trade duration was between roughly 2 to 5 months as discovered in optimization.

After making sure the libraries are up to date, the Volume Flow (VFI) indicator used in the article code will appear under the TASC Magazine Indicators group. It can be plotted on a chart and be used as an entry or exit condition in a Rule-based Strategy without having to program a line of code yourself.

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

namespace WealthLab.Strategies { public class TASC201806 : WealthScript { private StrategyParameter _w1; private StrategyParameter _w2; private StrategyParameter _w3; private StrategyParameter _w4; private StrategyParameter _w5; private StrategyParameter _exit; public TASC201806() { _w1 = CreateParameter("VFI", 1, 1, 1, 1); _w2 = CreateParameter("MA", 1, 1, 1, 1); _w3 = CreateParameter("MA > MA-4", 1, 1, 1, 1); _w4 = CreateParameter("Stiffness", 1, 1, 1, 1); _w5 = CreateParameter("Market", 2, 2, 2, 1); _exit = CreateParameter("Time exit", 20, 20, 180, 10); } protected override void Execute() { //parameters int w1 = _w1.ValueInt, w2 = _w2.ValueInt, w3 = _w3.ValueInt, w4 = _w4.ValueInt, w5 = _w5.ValueInt, TimedExit = _exit.ValueInt; var vfi = VFI.Series(Bars, 130, 3, 0.2, 2.5); var spy = GetExternalSymbol("SPY",true); var emaSpy = EMAModern.Series( spy.Close, 100 ); var maxStiffness = 7; var ScoreRating = 5;

//STIFFNESS var MA100 = TASCIndicators.FastSMA.Series(Close, 100); var closeBelowMA100 = SeriesIsBelow.Series(Close, MA100, 1); var Stiffness = Sum.Series(closeBelowMA100, 63); // DIPS BELOW MA var Score = new DataSeries(Bars,"Score"); for(int bar = 4; bar < Bars.Count; bar++) { var cond1 = (vfi[bar] > 0) ? 1 : 0; //MONEY FLOW var cond2 = (Close[bar] > MA100[bar]) ? 1 : 0; //MA var cond3 = (MA100[bar] > MA100[bar - 4]) ? 1 : 0; //MA DIRECTION var cond4 = (Stiffness[bar] <= maxStiffness) ? 1 : 0; //STIFFNESS var cond5 = (emaSpy[bar] >= emaSpy[bar - 2]) ? 1 : 0; //MARKET DIRECTION Score[bar] = w1*cond1 + w2*cond2 + w3*cond3 + w4*cond4 + w5*cond5; } for(int bar = GetTradingLoopStartBar(1); bar < Bars.Count; bar++) { if (IsLastPositionActive) { Position p = LastPosition; if ( bar+1 - p.EntryBar >= TimedExit ) SellAtMarket( bar+1, p, "Timed" ); } else { if( Score[bar] > ScoreRating ) BuyAtMarket( bar+1); } }

HideVolume(); var sp = CreatePane(40,false,true); var vp = CreatePane(30,false,true); var ep = CreatePane(80,false,true); PlotSeries( sp, Score, Color.DarkGreen, LineStyle.Histogram, 3); PlotSeries( vp,vfi,Color.FromArgb(255,0,0,0),LineStyle.Solid,2); PlotSymbol( ep,spy,Color.Blue,Color.Red); PlotSeries( ep,emaSpy,Color.Blue,LineStyle.Solid,1); } } }

Eugene (Gene Geren)
Wealth-Lab team
www.wealth-lab.com