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); } } } } }