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 kujista, Today, 05:44 AM
        0 responses
        5 views
        0 likes
        Last Post kujista
        by kujista
         
        Started by ZenCortexCLICK, Today, 04:58 AM
        0 responses
        5 views
        0 likes
        Last Post ZenCortexCLICK  
        Started by sidlercom80, 10-28-2023, 08:49 AM
        172 responses
        2,281 views
        0 likes
        Last Post sidlercom80  
        Started by Irukandji, Yesterday, 02:53 AM
        2 responses
        18 views
        0 likes
        Last Post Irukandji  
        Started by adeelshahzad, Today, 03:54 AM
        0 responses
        8 views
        0 likes
        Last Post adeelshahzad  
        Working...
        X