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 AaronKoRn, Yesterday, 09:49 PM
        1 response
        18 views
        0 likes
        Last Post Rikazkhan007  
        Started by ageeholdings, Today, 07:43 AM
        0 responses
        12 views
        0 likes
        Last Post ageeholdings  
        Started by pibrew, Today, 06:37 AM
        0 responses
        4 views
        0 likes
        Last Post pibrew
        by pibrew
         
        Started by rbeckmann05, Yesterday, 06:48 PM
        1 response
        14 views
        0 likes
        Last Post bltdavid  
        Started by llanqui, Today, 03:53 AM
        0 responses
        9 views
        0 likes
        Last Post llanqui
        by llanqui
         
        Working...
        X