Description
The Momentum indicator is a speed of movement (or rate of change) indicator, that is designed to identify the speed (or strength) of a price movement. Usually, the momentum indicator compares the most recent closing price to a previous closing price, but it can also be used on other indicators such as moving averages. The momentum indicator is usually displayed as a single line, on its own chart, separate from the price bars, and is the bottom section in the example chart (view full size chart).
The momentum indicator identifies when the price is moving upwards or downwards, and also by how much the price is moving upwards or downwards. When the momentum indicator is above 0 (zero), the price has upwards momentum, and when the momentum indicator is below 0 (zero) the price has downwards momentum. The momentum indicator can be used on its own, or as part of a larger trading system.
using System; using System.Collections; using System.Collections.Generic; using System.Text; using PTLRuntime.NETScript; using System.Drawing; namespace ind { //--------------------------------------------------- // Project: Momentum // Type: Indicator // Author: PFSoft LLC // Company: PFSoft LLC /www.pfsoft.com/ // Copyright: (C) PFSoft LLC Dnepopetrovsk. Ukraine // Created: Nov, 28,2006 //--------------------------------------------------- public class MOMENTUM : NETIndicator { public MOMENTUM() : base() { ProjectName = "Momentum"; Comments = "Momentum"; SetIndicatorLine("line1", Color.Lime, 2, LineStyle.DotLineChart); SeparateWindow = true; } [InputParameter("Period of momentum: ", 0)] public int MomPeriod = 20; public override void OnQuote() { int count = platform.BarsCount(platform.Symbol, platform.Period); if(count>MomPeriod) platform.SetValue(0, 0, ptl.Close - ptl.Close[MomPeriod]); } } }
Comments