MTF mfi

Created at 19 Feb 2018, 02:31
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
ON

oneplusoc

Joined 09.03.2015

MTF mfi
19 Feb 2018, 02:31


hey

can any one help me to do this indicator mtf or add time select 

thanks 

// -------------------------------------------------------------------------------
//
//   This will draw the value of the MFI on the chart
//
// -------------------------------------------------------------------------------

using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;

namespace cAlgo.Indicators
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC)]
    public class DrawMFI : Indicator
    {
        [Parameter(DefaultValue = 14)]
        public int Period { get; set; }

        private MoneyFlowIndex _moneyFlow;


        protected override void Initialize()
        {
            _moneyFlow = Indicators.MoneyFlowIndex(Period);
        }

        public override void Calculate(int index)
        {

            DisplayMFIChart();
        }



        private void DisplayMFIChart()
        {

            string text = string.Format("Mfi: {0}", _moneyFlow.Result.LastValue);

            ChartObjects.DrawText("MFI", text.PadLeft(10), StaticPosition.BottomRight, Colors.Red);
        }
    }


@oneplusoc
Replies

oneplusoc
22 Feb 2018, 22:41

Hello 

i try to put  Parameter(DefaultValue = "Daily")] but not working can any one fixed it 

thanks

 

// -------------------------------------------------------------------------------
//
//   This will draw the value of the MFI on the chart
//
// -------------------------------------------------------------------------------

using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;

namespace cAlgo.Indicators
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC)]
    public class DrawMFI : Indicator
    {
        [Parameter(DefaultValue = 14)]
        public int Period { get; set; }
        [Parameter(DefaultValue = "Daily")]=====================================================
        public TimeFrame _moneyFlowTimeframe { get; set; }

        private MoneyFlowIndex _moneyFlow;


        protected override void Initialize()
        {
            _moneyFlow = Indicators.MoneyFlowIndex(Period);
        }

        public override void Calculate(int index)
        {

            DisplayMFIChart();
        }



        private void DisplayMFIChart()
        {

            string text = string.Format("Mfi: {0}", _moneyFlow.Result.LastValue);

            ChartObjects.DrawText("MFI", text.PadLeft(10), StaticPosition.BottomRight, Colors.Red);
        }
    }
}


@oneplusoc