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

Stoploss Fill

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

    Stoploss Fill

    I am testing strategy via Strategy Analyzer. When the position is open the strategy setup the stoploss at the Fibonacci level 223.6.
    But it exites at close of the bar even though I use ExitOnClose = false;
    1) Do you know why?
    2) Both the entry and stoploss should be shown at the previous bar (23:50) than it is (23:55), please can you help?

    #2
    Hello Luigio,

    Thanks for your post.

    ExitOnClose refers to the session hours of the data series and it means if a position is open at the end of the session, to then close the trade(s). So it would not relate to this exit. Reference: https://ninjatrader.com/support/help...xitonclose.htm

    In backtesting, the strategy will always be a bar behind because the decision to make a trade is in one bar and the trade placement is on the next bar. The strategy executes once per bar at the close of the bar when backtesting.

    We recommend that you debug your strategy by printing out the specific values that you are setting the stop at to ensure it is as expected. Here is a link to our debugging tips: https://ninjatrader.com/support/help...script_cod.htm

    In addition here is further information you may find useful:



    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Ok I get it. But what is for the optimization of strategy if all losing trades will be on closes instead of the relevant stoplosses. The results of optimization neither bactesting won't give me any information I need.

      Comment


        #4
        Hello Luigio,

        Thanks for your reply.

        Just to clarify my response, your code will execute at the end of a bar which is the same as setting the calculation mode of Calculate.OnBarClose. It does not mean, "all losing trades will be on closes instead of the relevant stoplosses".

        Your stop loss will depend on the exit method used and the variable data provided. This is where you need to spend your debugging efforts.
        Paul H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by elderan, Yesterday, 08:03 PM
        1 response
        12 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by samish18, Yesterday, 08:57 AM
        8 responses
        25 views
        0 likes
        Last Post samish18  
        Started by DJ888, 04-16-2024, 06:09 PM
        3 responses
        10 views
        0 likes
        Last Post NinjaTrader_Erick  
        Started by RookieTrader, Today, 07:41 AM
        0 responses
        3 views
        0 likes
        Last Post RookieTrader  
        Started by maybeimnotrader, Yesterday, 05:46 PM
        1 response
        19 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Working...
        X