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 cmoran13, Yesterday, 01:02 PM
    0 responses
    30 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    22 views
    0 likes
    Last Post PaulMohn  
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    160 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    95 views
    1 like
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    148 views
    2 likes
    Last Post CaptainJack  
    Working...
    X