Description
Follow my cTrader Telegram group at https://t.me/cTraderCommunity; it's a new community but it will grow fast, plus everyone can talk about cTrader indicators and algorithm without restrictions, though it is not allowed to spam commercial indicators to sell them. There's also a Discord Server now @ https://discord.gg/5GAPMtp
This is the Vortex indicator.
UPDATE: Added Bubble HighLighting
For any bug report or suggestion, contact me by joning the group linked above or by commenting below
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 Vortex : Indicator
{
[Parameter("Periods", DefaultValue = 21)]
public int per { get; set; }
[Parameter("HighLight Bubbles", DefaultValue = false)]
public bool bubble { get; set; }
[Output("VM+", LineColor = "Cyan")]
public IndicatorDataSeries vmp { get; set; }
[Output("VM-", LineColor = "Red")]
public IndicatorDataSeries vmm { get; set; }
private IndicatorDataSeries tr, vmPlus, vmMinus;
protected override void Initialize()
{
tr = CreateDataSeries();
vmPlus = CreateDataSeries();
vmMinus = CreateDataSeries();
}
public override void Calculate(int index)
{
tr[index] = Math.Max(Math.Max(MarketSeries.High[index] - MarketSeries.Low[index], Math.Abs(MarketSeries.High[index] - MarketSeries.Close[index - 1])), Math.Abs(MarketSeries.Low[index] - MarketSeries.Close[index - 1]));
vmPlus[index] = Math.Abs(MarketSeries.High[index] - MarketSeries.Low[index - 1]);
vmMinus[index] = Math.Abs(MarketSeries.Low[index] - MarketSeries.High[index - 1]);
double sumTR = 0, sumVMP = 0, sumVMM = 0;
for (int i = 0; i < per; i++)
{
sumTR += tr[index - i];
sumVMP += vmPlus[index - i];
sumVMM += vmMinus[index - i];
}
vmp[index] = sumVMP / sumTR;
vmm[index] = sumVMM / sumTR;
if (bubble)
IndicatorArea.DrawTrendLine("bubble" + index, index, vmp[index], index, vmm[index], vmp[index] > vmm[index] ? Color.Cyan : Color.Red, 3);
}
}
}
CY
cysecsbin.01
Joined on 10.11.2018 Blocked
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: Vortex.algo
- Rating: 5
- Installs: 1697
- Modified: 13/10/2021 09:54
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.
Wow.. thanks for coding this, much appreciated... I have joined your Discord Server...
Cysecsbin, your recent indicators include some fantastic ideas.... Hope you have the time to keep them coming.