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

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:	118
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
      Brandon H.NinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by DJ888, Today, 10:57 PM
      0 responses
      5 views
      0 likes
      Last Post DJ888
      by DJ888
       
      Started by MacDad, 02-25-2024, 11:48 PM
      7 responses
      158 views
      0 likes
      Last Post loganjarosz123  
      Started by Belfortbucks, Today, 09:29 PM
      0 responses
      7 views
      0 likes
      Last Post Belfortbucks  
      Started by zstheorist, Today, 07:52 PM
      0 responses
      7 views
      0 likes
      Last Post zstheorist  
      Started by pmachiraju, 11-01-2023, 04:46 AM
      8 responses
      151 views
      0 likes
      Last Post rehmans
      by rehmans
       
      Working...
      X