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 alifarahani, Today, 09:40 AM
            6 responses
            31 views
            0 likes
            Last Post alifarahani  
            Started by Waxavi, Today, 02:10 AM
            1 response
            17 views
            0 likes
            Last Post NinjaTrader_LuisH  
            Started by Kaledus, Today, 01:29 PM
            5 responses
            14 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Started by Waxavi, Today, 02:00 AM
            1 response
            12 views
            0 likes
            Last Post NinjaTrader_LuisH  
            Started by gentlebenthebear, Today, 01:30 AM
            3 responses
            17 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Working...
            X