using System; using System.Collections.Generic; using System.Text; using System.Drawing; using WealthLab; using WealthLab.Indicators; using TASCIndicators;namespace WealthLab.Strategies { public class HACO_Demo : WealthScript { // Create slider parameters private StrategyParameter TemaPeriod; private StrategyParameter timeoutPeriod; public HACO_Demo() { TemaPeriod = CreateParameter("TEMA Period", 34, 10, 120, 1); timeoutPeriod = CreateParameter("Timeout", 2, 1, 3, 1); } protected override void Execute() { // Plot HACO int period = TemaPeriod.ValueInt; HACO haco = HACO.Series( Bars, period, timeoutPeriod.ValueInt ); ChartPane hacoPane = CreatePane( 20, true, true ); PlotSeries( hacoPane, haco, Color.BlueViolet, LineStyle.Solid, 2 ); HideVolume(); for(int bar = period*3; bar < Bars.Count; bar++) { if ( haco[bar] == 1 ) { SetBarColor( bar, Color.FromArgb( 130, Color.Green ) ); SetBackgroundColor( bar, Color.FromArgb( 50, Color.Green ) ); } else if ( haco[bar] < 1 ) { SetBarColor( bar, Color.FromArgb( 130, Color.Red ) ); SetBackgroundColor( bar, Color.FromArgb( 50, Color.Red ) ); } } } } }