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 NullPointStrategies, Yesterday, 05:17 AM
    0 responses
    62 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    134 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    75 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    45 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    50 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X