• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

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 brucerobinson, Today, 05:52 AM
            2 responses
            4 views
            0 likes
            Last Post brucerobinson  
            Started by margandi, 10-09-2019, 03:01 AM
            9 responses
            25 views
            0 likes
            Last Post NinjaTrader_PaulH  
            Started by 2Look4me, Today, 08:50 AM
            2 responses
            5 views
            0 likes
            Last Post 2Look4me  
            Started by marcara, 10-11-2019, 03:08 AM
            4 responses
            24 views
            0 likes
            Last Post NinjaTrader_ChristopherD  
            Started by TheWhiteDragon, Today, 07:37 AM
            1 response
            5 views
            0 likes
            Last Post NinjaTrader_Kate  
            Working...
            X