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 ArmsIndex : WealthScript { private StrategyParameter period; private StrategyParameter mkt; public ArmsIndex() { period = CreateParameter("Smoothing Period",21,2,300,1); mkt = CreateParameter("NASDAQ/NYSE/AMEX",0,0,2,1); } protected override void Execute() { string Market = string.Empty; Dictionary<int,string> symList = new Dictionary<int,string>(); symList.Add( 0,"NASDAQ" ); symList.Add( 1,"NYSE" ); symList.Add( 2,"AMEX" ); switch (mkt.ValueInt) { case 0: Market = symList[0]; break; case 1: Market = symList[1]; break; case 2: Market = symList[2]; break; } // Get NASDAQ Advancing and Declining Issues and Volume "Market Sentiment" provider DataSeries AI = GetExternalSymbol( Market + "_advn", true ).Close; DataSeries DI = GetExternalSymbol( Market + "_decln", true ).Close; DataSeries AV = GetExternalSymbol( Market + "_advn", true ).Volume; DataSeries DV = GetExternalSymbol( Market + "_decln", true ).Volume; // Calculate Arms Index DataSeries ADI = AI / DI; DataSeries ADV = AV / DV; DataSeries ArmsIndex = ADI / ADV; // Plot Arms Index ChartPane ArmsPane = CreatePane(30,true,true); PlotSeries( ArmsPane, ArmsIndex, Color.Brown, LineStyle.Solid, 1, "Arms Index for " + Market + " Stocks" ); // Smooth it DataSeries Smoothed = SMA.Series( ArmsIndex, period.ValueInt ); PlotSeries( ArmsPane, Smoothed, Color.Navy, LineStyle.Solid, 2 ); } } }