Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Stop Loss fails

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

    Stop Loss fails

    Hello,

    I ask for your help because I do not know what I am doing wrong in this operation.

    If I run the attached code after 04/27/2021 at 21:00:01 (Only the second block of the code is executed)(Note Time Zone), everything is fine.

    But if I run it from before that date (Both code blocks are executed), it fails. It seems as the new StopLoss did not act, since the error tells me that the value of the StopLoss is not valid for the market price, but it indicates the value of the Stop Loss that is set in the first block.

    What I am doing wrong?

    Any help will be greatly appreciated.

    Thanks in advance.

    TEST ENVIRONMENT:

    Account: Simulated account with $ 10,000 of initial balance
    Connection: Playback Connection
    Instrument: M6E 06-21
    Candles width: 60-minutes
    Ninja Version: Ninja Trader 8 version 8.0.24.2 64-bit.
    Time Zone: (UTC+01:00) Bruselas, Copenhague, Madrid, París
    Attached Files

    #2
    Hello JoseFRS,

    Thanks for your post.

    We recommend using bar close time instead of connection time for test examples.

    When setting the new value of the stop-loss, it would be a good practice to first check that the stop-loss is being set to a correct value relative to the current price.

    When using signal names, please use different signal names for your entries, you are using the same signal name for both the long and the short entries.

    In the 2nd block you are using ExitLong() and EnterShort(), keep in mind that this can cause unexpected positions because the Entry methods will automatically close positions in the opposite direction. If you are seeking to reverse the position then you would only need the entry methods (but again with different signal names for the entries and the associated stoploss).

    Comment


      #3
      Hi Paul,

      Thank yoy very much for all again.

      Your advices works fine.

      A greeting.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NullPointStrategies, Yesterday, 05:17 AM
      0 responses
      54 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      131 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      73 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      44 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      49 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X