Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

attaching stop to an indicator

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

    attaching stop to an indicator

    how can we in a strategy attach a stop to an indicator and update it on every bar close? it is working for when a trade is triggered but it sits there and never moves on the next bar update.

    #2
    Hello babouin77,

    Thank you for your post.

    Is this a strategy you're coding manually in the NinjaScript Editor or in the Strategy Builder?

    If in the Strategy Builder, you will need to use Exit orders in the Conditions and Actions screen so the price the order is placed at may be updated to trail the indicator in question. I've created a simple example of this approach that enters long and submits a stop that will trail along with the EMA as long as the EMA is below the current price. If the price goes up to a specific number of ticks above the entry, we submit a market order to exit as a profit target.


    I've also created a simple example of manually coding this so you can use Set methods like SetTrailStop - your code would need to be unlocked to use Set Methods in this way.

    Basically you have to call the method to submit the stop again, which will update the original order to the new price.

    Please let us know if we may be of further assistance to you.
    Attached Files

    Comment


      #3
      Thank you. I will test it out and let you know if I have any questions.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NullPointStrategies, Yesterday, 05:17 AM
      0 responses
      59 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