Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Using Previous bar in stop strategy

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

    Using Previous bar in stop strategy

    I am trying build a simple strategy that either sounds an alarm or exits trade when the current bar close is below/above previous bar's low.

    Can't seem to build that in Strategy Builder.

    Any ideas?

    #2
    Hello cmv727,

    Thank you for your note.

    I put together a sample strategy in the builder which will close an open long position (if one exists) and sounds an alarm when the close of the current bar is lower than the previous bars low.

    To Import a NinjaScript into NinjaTrader 8 do the following:From the Control Center window select Tools -> Import-> NinjaScript...
    Find the file location.

    Please let us know if you need further assistance.
    Attached Files
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Thank you!

      Comment


        #4
        Again, thank you. Unfortunately I wasn't able to get the strategy to execute on a bar close lower than the previous bar close. Any ideas?

        Comment


          #5
          Originally posted by cmv727 View Post
          Again, thank you. Unfortunately I wasn't able to get the strategy to execute on a bar close lower than the previous bar close. Any ideas?
          What strategy?
          You mean the sample provided to you?

          The sample strategy provided to you was not a complete strategy.

          If you look at the code provided I presume that Alan was hoping you would see the 'Set 1' and notice that the code line shown was created from Strategy Builder. See attached screenshot for how to create that code line via the Strategy Builder -- it's the the same as what Alan provided you.

          Btw, what you said in in your first post was "current bar close is below/above previous bar's low" which is exactly what Alan's sample code illustrated.

          But your quote above is "execute on a bar close lower than the previous bar close".

          These two requests are not the same thing.
          Attached Files

          Comment


            #6
            Hello cmv727,

            As bltdavid was kind enough to point out, what I provided was simply a sample which will exit a trade if there is a close below the previous bars low, and sets off an alarm.

            If you wanted to add entry logic to that sample you could click "Set 2" and define your entry logic, for example a SMA cross, an example you can find on preloaded on your NinjaTrader SampleMACross.

            Please let us know if you need further assistance.
            Alan P.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by NullPointStrategies, Today, 05:17 AM
            0 responses
            43 views
            0 likes
            Last Post NullPointStrategies  
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            124 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            65 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            42 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            46 views
            0 likes
            Last Post TheRealMorford  
            Working...
            X