Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

if (BarsInProgress == 0)

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

    if (BarsInProgress == 0)

    Hi,
    How/Where do I implement the BarsInProgress overload on the following? Both are intended to look at the primary bar size.

    if (BSE == 1)
    {
    ExitLong(); ExitShort();
    }

    else if (BarsSinceEntryExecution() == BSE - 1)
    {
    ExitLong(); ExitShort();
    }​

    #2
    Hello trader3000a,

    Thank you for your post.

    I suggest reviewing the BarsInProgress page of the help guide, which includes a snippet that isolates logic depending on if the primary series is calling OnBarUpdate() or if an added series is calling OnBarUpdate();We have an overview of Multi-Time Frame & Instruments here:Additionally, the different help guide pages for order methods from the managed approach typically include an overload that allows you to specify int barsInProgressIndex. This is considered Advanced Order Handling and is detailed in the "Working with a Multi-Instrument Strategy" on the following page:Please let us know if we may be of further assistance.

    Comment


      #3
      Hi,
      I've looked at the documentation and tried a few things, including:

      if (BSE == 1)
      {
      ExitLong(); ExitShort();
      }

      else if (BarsInProgress == 0)
      {
      if (BarsSinceEntryExecution() == BSE - 1)
      {
      ExitLong(); ExitShort();
      }
      }

      but i still get the error:
      Strategy 'openPEET': Error on calling 'OnBarUpdate' method on bar 20: Strategy 'openPEET/-1': You must use the overload that has a 'BarsInProgress' parameter when calling the BarsSinceEntryExecution() method in the context of a multi-time frame and instrument strategy.​

      Comment


        #4
        Hello trader3000a,

        Thank you for your reply.

        You are calling BarsSinceEntryExecution() though you will need to call BarsSinceEntryExecution(int barsInProgressIndex, string signalName, int entryExecutionsAgo) because you have a multi-series strategy. The syntax is listed here:You may use '' for signalName if you do not wish to specify a signal name, and you may use 0 for the last entry execution on entryExecutionsAgo if needed.

        Thank you for your patience.

        Comment


          #5
          Hi Emily,
          Thanks. That did the trick
          David

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by NullPointStrategies, Yesterday, 05:17 AM
          0 responses
          65 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          139 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          75 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          45 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          50 views
          0 likes
          Last Post TheRealMorford  
          Working...
          X