Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to reference bars since last execution in multi time frame

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

    How to reference bars since last execution in multi time frame


    I am getting error but cant find an example how to reference it correctly
    You must use the overload that has a 'BarsInProgress' parameter when calling the BarsSinceExitExecution() method in the context of a multi-time frame and instrument strategy.

    (BarsSinceExitExecution("SLS") > 1 || BarsSinceExitExecution("SLS") == -1)

    Also i am making to use stoch filter from both series with this code
    Code:
    ((IsStochFilter) ? (StochasticsFast1.D[0] <= 70) && (StochasticsFast1.D[0] >= 1)
                        && (StochasticsFast1.D[1][0] <= 70) && (StochasticsFast1.D[1][0] >= 1)
                        : Close[0] > 0)​
    but i get this error. Can you please help?
    Click image for larger version

Name:	image.png
Views:	188
Size:	4.8 KB
ID:	1251892
    Last edited by tkaboris; 05-18-2023, 07:09 AM.

    #2
    You will want to read: https://ninjatrader.com/support/help...yexecution.htm and https://ninjatrader.com/support/help...texecution.htm

    It would be like: BarsSinceExitExecution(BIP, "SLS", 0) where BIP is the bars in progress you placed the orders to.
    Bruce DeVault
    QuantKey Trading Vendor Services
    NinjaTrader Ecosystem Vendor - QuantKey

    Comment


      #3
      Hello tkaboris,

      Thanks for your post.

      You must use the BarsSinceExitExecution() syntax that allows you to pass in a barsInProgressIndex parameter as QuantKey_Bruce stated. The BarsInProgress that you placed the orders to would be assigned to the barsInProgressIndex parameter.

      The syntax can be seen below and in the BarsSinceExitExecution() help guide page.

      BarsSinceExitExecution(int barsInProgressIndex, string signalName, int exitExecutionsAgo)

      See the help guide documentation below for more information.

      BarsSinceExitExecution: https://ninjatrader.com/support/help...texecution.htm
      Working with Multi-Timeframe/Multi-Instrument NinjaScripts: https://ninjatrader.com/support/help...nstruments.htm

      In regard to the indexing error message, you can only apply a single index to the StochasticsFast indicator method. This means that you cannot use StochasticsFast1.D[1][0] in your script.

      If you would like to get the StochasticsFast indicator value calculated from an added series, you must use the syntax that allows you to specify an ISeries<double> input and pass in the BarsArray index of the added series for that parameter.

      Syntax: StochasticsFast(ISeries<double> input, int periodD, int periodK).D[int barsAgo]

      For example:

      StochasticsFast(BarsArray[1], 3, 14).D[0];

      See the help guide documentation below for more information.

      StochasticFast: https://ninjatrader.com/support/help...stics_fast.htm
      Using Bars Objects as input to Indicator methods: https://ninjatrader.com/support/help...dicatorMethods
      <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NullPointStrategies, 03-13-2026, 05:17 AM
      0 responses
      86 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      151 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      79 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      53 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      61 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X