Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

On SampleMultiTimeFrame

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

    On SampleMultiTimeFrame

    Hi NT experts,

    In your sample code on SampleMultiTimeFrame, the condition is to process event on BarsInProgress =0:
    if (BarsInProgress != 0)
    return;

    However, the following code starts to evalaute values on BarsInProgress 1 and 2:
    if (SMA(BarsArray[1], 5)[0] > SMA(BarsArray[1], 50)[0] && SMA(BarsArray[2], 5)[0] > SMA(BarsArray[2], 50)[0])

    I would assume SMA(BarsArray[1], 5)[0] would produce an error as it tries to get value from BarsArray[1] instead of 0.

    A realted question. What if no such contions as
    if (BarsInProgress != 0) return;

    Will this sample prouce same results?

    Regards,



    #2
    With this check we ensure that OnBarUpdate() calls only would have an effect when being issued from the primary series, all other calls would cause a return out.

    You can still check the BarsArray 1 and 2, as this is just a 'container' offering access to all the bars objects data points, however the call to check the specific array you need will only come from an OnBarUpdate() from the primary series.

    If not ensuring proper BIP calls, the orders for example good get routed to wrong objects, as the call is EnterLong() without including a specific BIP.

    Comment


      #3
      Thanks, Bertrand.

      Let me paraphrase to see if my understanging is accurate:

      a) The data and calculation of secondary series are accessiable when processing event on primary series.

      b) the following should work under the condition (if (BarsInProgress != 0) return:
      EnterLongStop(0, true, int quantity, Highs[1][1],string signalName).
      The High of previous bar's high on seconary series will be correctly evaluated when submitted this order from primary series.

      Let me know if these are correct.

      Regards,

      Comment


        #4
        This is correct BinWang2.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        647 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        368 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        108 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        571 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        573 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X