Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Using negative value in SetStopLoss (Ticks) for breakeven

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

    Using negative value in SetStopLoss (Ticks) for breakeven

    ran into something interesting in ninjascript that compiles and works but apparently produces an error on NT8 startup.

    i was experimenting using SetStopLoss(CalculationMode.Ticks, -2, false) so this way no matter which direction the trade is in the stoploss would always move above (or below for shorts) breakeven by 2 ticks. this seems to function properly in strategy analyzer (shown in image 1) but when launching nt8 i always get the error shown in image 2.

    im curious what the devs at NT8 say about this. is it fine to use? is it a bug? would love to know yalls thoughts and actually i think allowing negative numbers in SetStopLoss just makes sense to me, if its not already a feature.

    #2
    hello travelingsalesman,

    The offset for targets needs to be a positive number, using a negative number there would not be supported and may cause issues.

    The Set methods automatically calculate the correct offset based on the direction of the trade so a positive number is always used for both directions.

    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
    118 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