Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Profit Target/Stop Loss

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

    Profit Target/Stop Loss

    Hi there, I'm a new user of NinjaTrader and I must say I am very impressed with the features, especially the ease of use for the Strategy wizard. I have just created my first strategy for testing but I have encountered a problem with the Profit Target/Stop Loss mechanism. I have set the Profit Target and Stop Loss to 5 ticks in the code but upon running the Strategy, the backtester does not close the position even if I am up or down by more than 5 ticks.

    I have inserted a screenshot to illustrate the problem.


    Below is the code for the initialize method:

    protected override void Initialize()
    {
    Add(Bollinger(BB_std_dev, BB_periods));
    Add(Bollinger(BB_std_dev, BB_periods));
    Add(Bollinger(BB_std_dev, BB_periods));
    Add(Bollinger(BB_std_dev, BB_periods));
    Add(RSI(Close, RSI_periods, 0));
    Add(Bollinger(BB_std_dev, BB_periods));
    Add(Bollinger(BB_std_dev, BB_periods));
    Add(Bollinger(BB_std_dev, BB_periods));
    Add(Bollinger(BB_std_dev, BB_periods));
    SetProfitTarget("Short Signal", CalculationMode.Ticks, 5);
    SetStopLoss("Short Signal", CalculationMode.Ticks, 5, false);
    SetProfitTarget("Long Signal", CalculationMode.Ticks, 5);
    SetStopLoss("Long Signal", CalculationMode.Ticks, 5, false);

    CalculateOnBarClose = false;
    }

    Any ideas why this is happening?

    #2
    Welcome to the forums and thanks for the kind words - please try without any custom signal names / from entry signal entries in the strategy, it might be a typo in there so it's not picked up as you would expect. If this still not works, please attach the zip export so we can take a closer look.

    Thanks

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    633 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    364 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    105 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    567 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    568 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X