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

SetProfitTarget works in backtesting but not in live trading. Why?

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

    SetProfitTarget works in backtesting but not in live trading. Why?

    Hello!

    I created a strategy that scales out half of the position at target 1 and the other at target 2. I followed Josh's example on scale out by using SetProfitTarget:

    SetProfitTarget("P1", CalculationMode.Ticks, 10);
    SetProfitTarget("P2", CalculationMode.Ticks, 20);

    EnterLong(5, "P1");
    EnterLong(5, "P2");

    The strategy worked as expected in my backtesting. However, in living trading, my whole position was scaled out at target 1. I couldn't believe my eyes and applied the exact same strategy on the same (but now historical) data. It again worked as expected, that is, exiting half at target 1 and the other at target 2.

    This problem is very puzzling to me. Any help, please!


    #2
    ooppie,

    I am unable to reproduce on my end. Please post your code. Thanks.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      I noticed something similiar in Chart Trader. If you use the same strategy twice at 2 different prices, the stops are just combined even though they should be in different places. I worked around it by just creating the same strategy twice with different names.

      Comment


        #4
        Stainless2000,

        Please ensure your stops are truly at different price points by looking on the Control Center orders tab. On my end, different price stops from the same strategy but different instances of them are shown separately in my Chart Trader.

        Once the two strategy instances become in sync with each other then Chart Trader will show the stops together because they are at the same price.
        Josh P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Brevo, Today, 01:45 AM
        0 responses
        2 views
        0 likes
        Last Post Brevo
        by Brevo
         
        Started by aussugardefender, Today, 01:07 AM
        0 responses
        3 views
        0 likes
        Last Post aussugardefender  
        Started by pvincent, 06-23-2022, 12:53 PM
        14 responses
        238 views
        0 likes
        Last Post Nyman
        by Nyman
         
        Started by TraderG23, 12-08-2023, 07:56 AM
        9 responses
        384 views
        1 like
        Last Post Gavini
        by Gavini
         
        Started by oviejo, Today, 12:28 AM
        0 responses
        4 views
        0 likes
        Last Post oviejo
        by oviejo
         
        Working...
        X