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 kinfxhk, 07-13-2026, 10:18 AM
    0 responses
    58 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 07-13-2026, 09:50 AM
    0 responses
    41 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 07-13-2026, 07:21 AM
    0 responses
    46 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 07-11-2026, 02:11 AM
    0 responses
    37 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by SalmaTrader, 07-07-2026, 10:26 PM
    0 responses
    156 views
    0 likes
    Last Post SalmaTrader  
    Working...
    X