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 AaronKoRn, Today, 09:49 PM
        0 responses
        7 views
        0 likes
        Last Post AaronKoRn  
        Started by carnitron, Today, 08:42 PM
        0 responses
        9 views
        0 likes
        Last Post carnitron  
        Started by strategist007, Today, 07:51 PM
        0 responses
        10 views
        0 likes
        Last Post strategist007  
        Started by StockTrader88, 03-06-2021, 08:58 AM
        44 responses
        3,977 views
        3 likes
        Last Post jhudas88  
        Started by rbeckmann05, Today, 06:48 PM
        0 responses
        9 views
        0 likes
        Last Post rbeckmann05  
        Working...
        X