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

Problem using BarsSinceEntryExecution

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

    Problem using BarsSinceEntryExecution

    When I add this condition to my strategy, the Strategy Optimizer never takes a trade.

    Code:
    // Set 1
    if ((blah blah blah)
      && (blah blah blah)
      && (BarsSinceEntryExecution() > 10 || BarsSinceEntryExecution() == -1))
    {
    ....
    I have tried adding the signal name as well.

    (BarsSinceEntryExecution("LongEntry")>10 || BarsSinceEntryExecution("LongEntry")==-1)

    #2
    Hello Trader_Mark,

    Does your strategy include exits?

    I am unable to replicate the issue you are having, see attached.

    So I may test on my end, please upload the strategy in the format below,

    To export a NinjaScript from NinjaTrader 8 do the following:
    From the Control Center window select Tools -> Export -> NinjaScript...
    Click Add>Select the indicator>OK>Export.
    Then attach that file you saved; under My Docs>NT8>Bin>Custom>Select the downloaded .zip file.
    Attached Files
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Thank you.

      Strategy attached.

      Comment out the BarsSince.... condition and you should get trades. With that line in, I do not.
      Last edited by Trader_Mark; 08-18-2017, 04:24 AM.

      Comment


        #4
        Hello Trader_Mark,

        Running the strategy I get the following error in the log,

        8/17/2017 1:39:33 PM Default Strategy 'Kaboom': Error on calling 'OnBarUpdate' method on bar 4349: Strategy 'Kaboom/114383134': 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.

        Please see the Note: in the following section of our helpguide in regards to multiseries strategies.


        Please let us know if you need further assistance.
        Alan P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by trilliantrader, 04-18-2024, 08:16 AM
        4 responses
        18 views
        0 likes
        Last Post trilliantrader  
        Started by mgco4you, Today, 09:46 PM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by wzgy0920, Today, 09:53 PM
        0 responses
        9 views
        0 likes
        Last Post wzgy0920  
        Started by Rapine Heihei, Today, 08:19 PM
        1 response
        10 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by Rapine Heihei, Today, 08:25 PM
        0 responses
        10 views
        0 likes
        Last Post Rapine Heihei  
        Working...
        X