Arms Index (TRIN)

Modified on 2011/08/06 11:24 by Eugene — Categorized as: Community Indicators

Arms Index (TRIN Index): Indicator Documentation

Note! Actually, Arms Index isn't a part of the Community Indicators library. See code example below on how to calculate and plot the indicator.

Note! With MS123 IndexDefinitions library, constructing and plotting the Arms index (TRIN) for a DataSet has never been easier: no need to program, after installing the extension, just create it once using the Index Manager and then keep up to date.


The Arms Index, also known as TRIN, was developed by Richard Arms and is an indicator which determines market strength and breadth by analyzing the relationship between advancing and declining issues and their respective volume.



This example illustrates how to construct and plot Arms Index using Market Sentiment provider's symbology. Switch the parameter slider to build Arms index based on NASDAQ, NYSE or AMEX stocks.

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