DataSeries PPO( DataSeries ds, int Period1, int Period2 )
using System; using System.Collections.Generic; using System.Text; using System.Drawing; using WealthLab; using WealthLab.Indicators; using Community.Indicators;namespace WealthLab.Strategies { public class PPO_demo: WealthScript { private StrategyParameter Period1; private StrategyParameter Period2; public PPO_demo() { Period1 = CreateParameter("Period1", 9, 9, 30, 1); Period2 = CreateParameter("Period2", 26, 20, 50, 1); } protected override void Execute() { PPO ppo = PPO.Series( Close, Period1.ValueInt, Period2.ValueInt ); for (int bar = ppo.FirstValidValue; bar < Bars.Count; bar++) { if (IsLastPositionActive) { if ( ppo[bar] < 0 ) SellAtMarket( bar+1, LastPosition ); } else { if ( ppo[bar] > 0 ) BuyAtMarket( bar+1 ); } } ChartPane ppoPane = CreatePane( 20, true, true ); PlotSeries( ppoPane, ppo, Color.DarkRed, LineStyle.Histogram, 2 ); } } }