Intraday Momentum Index

by cysecsbin.01 in category Oscilator at 01/09/2019
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

Download
92 downloads
How to install
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.
Formula / Source Code
Language: C#
Trading Platform: cAlgocTrader
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);
        }
    }
}
Comments

Burak Birer - September 01, 2019 @ 19:24

Thank you

0