Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

My Stop Loss and Profit Target are moving with the current bar

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

    My Stop Loss and Profit Target are moving with the current bar

    Hello,

    I provided my code for the strategy, my goal is to make the my profit target and stop loss based on the indicator values at the time it entered into a position and not move anymore. For stop loss
    I use double previouslowerline = myindi.Lowerline[0]; but when I look sometimes on the backtested charts the bars where it finally ends in a stop loss are waaay far gone from the original value of the indicator. So I'm assuming my stop loss is dynamicly moving with the current bar?

    So I was wondering if you could help me out and Thank you in advance
    Attached Files

    #2
    Hello christopher512,

    Call SetStopLoss() before calling an entry method (not after).
    https://ninjatrader.com/support/help...etposition.htm

    The stop price would only be updated if the SetStopLoss() method is called. In the code I am seeing that there is a return if the position is flat.
    Are you certain this line is being called?

    Print the time of the bar one line above the SetStopLoss() call. Are you seeing this print appearing?
    Code:
    https://ninjatrader.com/support/forum/forum/ninjatrader-7/strategy-development-aa/99209-date-conditions-not-working?p=791121#post791121
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    88 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    134 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    68 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    119 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    67 views
    0 likes
    Last Post PaulMohn  
    Working...
    X