Category Other  Published on 25/01/2015

Sum

Description

A primitive indicator showing the sum of 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: Difference, Product and Ratio.


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 Sum : 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: Sum.algo
  • Rating: 0
  • Installs: 2599
  • Modified: 13/10/2021 09:54
Comments
Log in to add a comment.
No comments found.