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 trilliantrader, 04-18-2024, 08:16 AM
        4 responses
        18 views
        0 likes
        Last Post trilliantrader  
        Started by mgco4you, Today, 09:46 PM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by wzgy0920, Today, 09:53 PM
        0 responses
        9 views
        0 likes
        Last Post wzgy0920  
        Started by Rapine Heihei, Today, 08:19 PM
        1 response
        10 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by Rapine Heihei, Today, 08:25 PM
        0 responses
        10 views
        0 likes
        Last Post Rapine Heihei  
        Working...
        X