Description
Follow my cTrader Telegram group at https://t.me/cTraderCommunity; 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 and an Instagram page https://www.instagram.com/ctrader_community/
This is the intraday momentum index
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 IMI : Indicator
{
[Parameter(DefaultValue = 14)]
public int Period { get; set; }
[Output("Main", LineColor = "Red")]
public IndicatorDataSeries Result { get; set; }
protected override void Initialize()
{
// Initialize and create nested indicators
}
public override void Calculate(int index)
{
double Gains = 0;
double Losses = 0;
for (int i = 0; i < Period; ++i)
{
Gains += MarketSeries.Close[index - i] > MarketSeries.Open[index - i] ? MarketSeries.Close[index - i] - MarketSeries.Open[index - i] : 0;
Losses += MarketSeries.Close[index - i] < MarketSeries.Open[index - i] ? -MarketSeries.Close[index - i] + MarketSeries.Open[index - i] : 0;
}
Result[index] = 100 * Gains / (Gains + Losses);
}
}
}
CY
cysecsbin.01
Joined on 10.11.2018 Blocked
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: IMI.algo
- Rating: 0
- Installs: 1732
- 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.
Thank you