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

Exit based off previous bars

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

    Exit based off previous bars

    Good Afternoon!

    Trying to use the search function didnt get me much as this is really specific.

    Like most of you I am trying to automate what i do manually. That is, set my exit based off two bar's ago's close low (long)/high(short)

    I have tinkered with set Profit Targets, Trailing Stops and it's not working.

    When i am manually trading and am long; with each new candle i'll move the stop loss to the bottom of the candle 2 candles ago.

    does that make sense?


    Thanks in advance,

    CM.

    #2
    Hello CM,

    I have an example that demonstrates changing the price of an exit order. You can do this when a bar closes, or by adding intra-bar data having trailing and chasing actions happen intra-bar.

    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      thanks!

      i downloaded the first zip, i just copy and paste into my code and adjust the integers correct?

      Comment


        #4
        Hello Mossive,

        This is meant to be an example.

        I would recommend starting a new strategy and uses this as an example to model your code after, but custom for what you are trying to do.

        Calculating the daliy loss is not necessary as this is not the conditions you want in your script.

        Instead, you would want to create triggers in OnExecution for when the stop loss or exit order fills.


        To import a NinjaScript into NinjaTrader 8 do the following:
        1. Download the script to your desktop, keep it in the compressed .zip file.
        2. From the Control Center window select Tools -> Import -> NinjaScript...
        3. Click the Desktop icon on the left to navigate to the desktop
        4. Select the downloaded .zip file -> then click Open
        5. NinjaTrader will then confirm if the import has been successful.


        Critical *Note that on any files that say "File already exists on your PC" that start with an "@" symbol are the ones that came preloaded inside of NinjaTrader so you would say "No" so that you do not override those files.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by cre8able, Today, 03:20 PM
        1 response
        9 views
        0 likes
        Last Post cre8able  
        Started by fiddich, Today, 05:25 PM
        0 responses
        3 views
        0 likes
        Last Post fiddich
        by fiddich
         
        Started by gemify, 11-11-2022, 11:52 AM
        6 responses
        804 views
        2 likes
        Last Post ultls
        by ultls
         
        Started by ScottWalsh, Today, 04:52 PM
        0 responses
        4 views
        0 likes
        Last Post ScottWalsh  
        Started by ScottWalsh, Today, 04:29 PM
        0 responses
        9 views
        0 likes
        Last Post ScottWalsh  
        Working...
        X