Log in to see Cloud of Tags

Wealth-Lab Wiki

TASC 2011-02 | Spearman indicator (Valcu)

RSS

Traders' Tip text

Wealth-Lab 6 users looking for a way to quickly plot Spearman indicator on a chart or utilize it in their strategies – either code-based or built interactively with our rule wizard tool – you can find the oscillator available in the TASCIndicator library. To update to its most recent version, visit our site at www.wealth-lab.com, click "Extensions" and install the library or simply get it from the built-in Extension Manager tool.


Image

Figure 1. A Wealth-Lab Developer 6.1 chart showing the Spearman-based system below applied to DAX 30 Index (DAX:IND, weekly).


It seems that on Daily charts, the Spearman indicator doesn't appear to be as productive as it could be on higher bar scales e.g. Weekly, where daily price wiggle is eliminated. The following long-only system illustrates one out of many possible ways to use the indicator: buy when it crosses zero coming from below, and sell when it crosses zero from above. In our limited testing, zero crossovers outperformed the crossings of the indicator with its short moving average.

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 SpearmanDemo : WealthScript { protected override void Execute() { Spearman sc = Spearman.Series(Close,10);

HideVolume(); ChartPane pane1 = CreatePane(30,false,true); PlotSeries(pane1,sc,Color.Blue,LineStyle.Solid,2); DrawHorzLine(pane1,0,Color.Red,LineStyle.Dashed,1);

for(int bar = GetTradingLoopStartBar(10); bar < Bars.Count; bar++) { // Detect crossover/crossunder and store state in a variable bool xover = CrossOver(bar, sc, 0); bool xunder = CrossUnder(bar, sc, 0);

if (IsLastPositionActive) { if( xunder ) SellAtMarket(bar + 1, LastPosition); } else { if( xover ) BuyAtMarket(bar + 1); } } } } }

Important Disclaimer: The information provided by Wealth-Lab is strictly for informational purposes and is not to be construed as advice or solicitation to buy or sell any security.  The owner of Wealth-Lab.com assumes no liability resulting from the use of the material contained herein for investment purposes. By using this web site, you agree to the terms of this disclaimer and our Terms of Use.


ScrewTurn Wiki. Some of the icons created by FamFamFam.