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

Trailing Stop Issue

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

    Trailing Stop Issue

    In the strategy builder, whenever I try to backtest a strategy with a trailing stop, the strategy analyzer comes back with every trade having been entered and exited at the same time.
    My summary shows that every trade fails with commission being the only dollar amount.
    Upon looking at the chart, every trade it would have made is showing an entry and exit at the same price on the same bar.
    I've made sure the trailing stop is the only exit condition.
    Does the strategy analyzer not function using a trailing stop? I feel like I've looked through every resource and can't find an answer.

    #2
    Hello ThatProblemGuy,

    Welcome to the NinjaTrader forums!

    What values have you used for the trailing stop?

    Enable TraceOrders and print the time of the bar and the position average price.

    Below is a link to a forum post that demonstrates using prints to understand behavior and discusses enabling TraceOrders.


    What is the position average price?
    What is the stop price of the order?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Is this the Print you are referring to?
      I set it to backtest from September.
      I see the issue being that it assumes the price to be zero in 99+% of cases, but I'm unsure how to fix that.

      NinjaScript Output 1_4_2022 3_01 AM.txt
      Attached Files

      Comment


        #4
        Hello ThatProblemGuy,

        Below is a direct link to TraceOrders in the help guide, that was linked in the forum post above in case this was overlooked.


        I'm not sure what is in this output as there are no labels. The post above highly encourages labeling the output so we know what numbers are.

        Is this is the Position.AveragePrice? Is this the <order>.AverageFillPrice when the order is OrderState.Filled?
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by zstheorist, Today, 07:52 PM
        0 responses
        3 views
        0 likes
        Last Post zstheorist  
        Started by pmachiraju, 11-01-2023, 04:46 AM
        8 responses
        149 views
        0 likes
        Last Post rehmans
        by rehmans
         
        Started by mattbsea, Today, 05:44 PM
        0 responses
        5 views
        0 likes
        Last Post mattbsea  
        Started by RideMe, 04-07-2024, 04:54 PM
        6 responses
        33 views
        0 likes
        Last Post RideMe
        by RideMe
         
        Started by tkaboris, Today, 05:13 PM
        0 responses
        5 views
        0 likes
        Last Post tkaboris  
        Working...
        X