Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Multi time frame problem

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Multi time frame problem

    Hi,

    I wrote indicator that display two MFI Values
    1. MFI that based on 1 min input , which is the main DataSeries (BarsInProgress = 0)
    2. MFI that based on 5 min input , (BarsInProgress = 2)

    So far is OK.

    I wrote second Indicator that used these values of the first Indicator.
    The problem is that sometimes the value of the 5 Min MFI is Wrong and doesn't match the value of the first indicator which is right.

    When I debug the second indicator and enter to the first indicator I saw that the MFI 5 min got wrong value.

    The First indicator look like this:
    protected override void OnBarUpdate()
    {
    if(CurrentBars[0] < m_mfiPeriod ||
    CurrentBars[1] < m_mfiPeriod )
    {
    return;
    }

    if (BarsInProgress != 0)
    return;

    // 1 min DataSeries
    double mfiTrigTmFrm = MFI(BarsArray[0], 15)[0];

    // 5 min DataSeries
    double mfiHTmFrm = MFI(BarsArray[1], 15)[0];

    SigPlotS.Set(mfiTrigTmFrm);
    SigPlotL.Set(mfiHTmFrm);
    }

    The second Indicator look like this:

    protected override void OnBarUpdate()
    {
    MfiPlotS.Set(KobiTmFrmMfiSigInd().SigPlotS[0]);
    MfiPlotL.Set(KobiTmFrmMfiSigInd().SigPlotL[0]);
    }

    Thanks, Kobi:

    #2
    Hi levikNT, are you setting the CalculateOnBarClose in those studies programmatically in the Initialize()?
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Bertrand View Post
      Hi levikNT, are you setting the CalculateOnBarClose in those studies programmatically in the Initialize()?
      Hi Bertrand,

      Yes I do, I am setting the CalculateOnBarClose in those studies programmatically in the Initialize().
      This problem is also occur in historical data.

      Kobi

      Comment


        #4
        Kobi, please don't set any CalculateOnBarClose in the Initialize() of scripts you want to access programmatically, the calling script can otherwise not overwrite as needed.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Bertrand View Post
          Kobi, please don't set any CalculateOnBarClose in the Initialize() of scripts you want to access programmatically, the calling script can otherwise not overwrite as needed.
          Hi Bertrand,

          I removed CalculateOnBarClose in the Initialize() but the problem still there.


          Kobi

          Comment


            #6
            Hi Kobi, could you please contact me via Help > Mail to Support with the indicator you try working with here attached? Would then review and give a run on our side. Thanks.
            BertrandNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by DJ888, 04-16-2024, 06:09 PM
            4 responses
            12 views
            0 likes
            Last Post DJ888
            by DJ888
             
            Started by terofs, Today, 04:18 PM
            0 responses
            5 views
            0 likes
            Last Post terofs
            by terofs
             
            Started by nandhumca, Today, 03:41 PM
            0 responses
            5 views
            0 likes
            Last Post nandhumca  
            Started by The_Sec, Today, 03:37 PM
            0 responses
            3 views
            0 likes
            Last Post The_Sec
            by The_Sec
             
            Started by GwFutures1988, Today, 02:48 PM
            1 response
            9 views
            0 likes
            Last Post NinjaTrader_Clayton  
            Working...
            X