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 on 03.04.2023
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: LT_Ind_Diff.algo
- Rating: 5
- Installs: 559
- Modified: 06/04/2023 04:26
Note that publishing copyrighted material is strictly prohibited. If you believe there is copyrighted material in this section, please use the Copyright Infringement Notification form to submit a claim.
Comments
Log in to add a comment.
No comments found.