Category Other  Published on 25/01/2015

Ratio

Description

A primitive indicator showing the ratio 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 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 Ratio : 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: Ratio.algo
  • Rating: 0
  • Installs: 2209
Comments
Log in to add a comment.
No comments found.