Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Setting a stop loss on the previous bars close that updates the cls it after each bar

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

    Setting a stop loss on the previous bars close that updates the cls it after each bar

    How do i set a stop loss on the close of the previous bars close. I want my indicators to always be trying to close on the previous bars close if it dips below the low.

    So i guess it would be a trailing stop sort of but how would i sort out the logic in order to get what im doing in the strategy wizard?


    After each bar i was a stop placed at the low of the previous bar compared to the current bar?


    Kind Regards,

    Cam (thanks)

    #2
    Would it be CrossBelow(Low,Close,1) Exit Long or vice versa for a short CrossAbove(high,close,1)?

    Kind Regards (please do it in a way that i can do it in the strategy wizard)

    Cam

    Comment


      #3
      Cam, I would just check with a comparison of the price values so the Close being smaller than the Low of one bar ago and then issue the order you seek (your ExitLong being a market order). The CrossBelow / CrossAbove condition would not be triggering here.
      BertrandNinjaTrader Customer Service

      Comment


        #4
        Sorry i meant to post in here as i created a forum for it.

        I've gotten this message before but don't understand it fully, i looked inside the .zip and can't make sense of exactly what i have to do to get the condition to be set on an Onbarupdate() at a priced based value. How do i create the condition on a price based value at the low of the last bar?
        I've read alot of content on this and can't seem to formulate the answer, its taken me 3 weeks to try.
        Could you help me out by trying to teach me the code that needs to be written from this inquiry?

        An example is like if the previous bar or two bars establish lows which they do i want my stop loss to me on it, or even a tick lower than the current bar. I don't know how to set that up in Ninjascript... Below is a paragraph i got but can't make logic out of it if you could help me descipher what this is saying in code. Id be greatly appreciative.

        Kind Regards,

        Cam

        "From the code what you want to do is working with SetStopLoss in the OnBarUpdate() method, here you can specifiy the stop loss to be set on your condition at a price based value, for example the Low of the last bar - http://www.ninjatrader.com/support/h...ub=SetStopLoss
        Whenever you recall SetStopLoss in OnBarUpdate(), your stop loss level would the be moved to the new supplied level you designate in your code - that's unfortunately not possible from the wizard."

        Comment


          #5
          Cameron, I got your email as well on this and will reply there with a short example to hopefully get you going.
          BertrandNinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by lightsun47, Today, 03:51 PM
          0 responses
          4 views
          0 likes
          Last Post lightsun47  
          Started by 00nevest, Today, 02:27 PM
          1 response
          8 views
          0 likes
          Last Post 00nevest  
          Started by futtrader, 04-21-2024, 01:50 AM
          4 responses
          44 views
          0 likes
          Last Post futtrader  
          Started by Option Whisperer, Today, 09:55 AM
          1 response
          13 views
          0 likes
          Last Post bltdavid  
          Started by port119, Today, 02:43 PM
          0 responses
          8 views
          0 likes
          Last Post port119
          by port119
           
          Working...
          X