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

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 funk10101, Today, 12:02 AM
            1 response
            11 views
            0 likes
            Last Post NinjaTrader_LuisH  
            Started by GLFX005, Today, 03:23 AM
            1 response
            6 views
            0 likes
            Last Post NinjaTrader_Erick  
            Started by nandhumca, Yesterday, 03:41 PM
            1 response
            13 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Started by The_Sec, Yesterday, 03:37 PM
            1 response
            11 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Started by vecnopus, Today, 06:15 AM
            0 responses
            1 view
            0 likes
            Last Post vecnopus  
            Working...
            X