Category Other  Published on 25/01/2015

Difference

Description

A primitive indicator showing difference between two source series. This is particularly useful as a building block for combining with other indicators, for creating chains of dependent indicators and for outsourcing data further. Also check out other basic building blocks: Ratio, Product and Sum.


using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;

namespace cAlgo {

    [Indicator (IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
	public class Difference : Indicator {
	
		[Parameter ()]
		public DataSeries Source1 { get; set; }
		
		[Parameter ()]
		public DataSeries Source2 { get; set; }
		
		[Output	("Result")]
		public IndicatorDataSeries Result { get; set; }

		protected override void Initialize () {
		}

		public override void Calculate (int index) {
			Result[index] = Source1[index] - Source2[index];
		}
	}
}


IG
igorkroitor

Joined on 03.01.2015

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: Difference.algo
  • Rating: 0
  • Installs: 2563
Comments
Log in to add a comment.
No comments found.