Description
Plot the difference between 2 signals.
Can select any sources with different shifting for each source.
Example 1: Visualize the Kumo Future:
Example 2: A simple momentum measurement:
Example 3: The Aroon Oscillator
using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
using LittleTrader;
using LittleTrader.Ehlers;
namespace cAlgo
{
[Levels(0)]
[Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class LT_Ind_Diff : Indicator
{
[Parameter("Minuend (A)")]
public DataSeries Minuend { get; set; }
[Parameter("Subtrahend (-B)")]
public DataSeries Subtrahend { get; set; }
[Parameter("MinuendShift (Pos for shift back)", DefaultValue = 0)]
public int MinuendShift { get; set; }
[Parameter("SubtrahendShift (Pos for shift back)", DefaultValue = 0)]
public int SubtrahendShift { get; set; }
[Parameter("Shift (Pos for shift the line forward)", DefaultValue = 0)]
public int Shift { get; set; }
[Output("Diff", LineColor = "Orange")]
public IndicatorDataSeries Diff { get; set; }
protected override void Initialize()
{
// Initialize and create nested indicators
}
public override void Calculate(int index)
{
// Calculate value at specified index
var diff = Minuend[index + MinuendShift] - Subtrahend[index + SubtrahendShift];
Diff[index + Shift] = diff;
}
}
}

dhnhuy
Joined 03.04.2023
- Type: Free
- Language: C#
- Trading Platform: cTrader Automate
- Filename: LT_Ind_Diff.algo
- Rating: 5
- Downloads: 258
Notification Publishing copyrighted material is strictly prohibited. If you believe there is copyrighted material in this section you may use the Copyright Infringement Notification form to submit a claim.
Comments
Only logged in users can post a comment
Comments not found