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

place limit entry and stopLoss exit at high and low of bar prior to test bar

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

    place limit entry and stopLoss exit at high and low of bar prior to test bar

    I'm trying to do this with this but it won't place any stops. The entries are generated, but no stops.

    Attached Files

    #2
    Hello trader3000a,

    Thanks for your post.

    It appears you are using the Strategy Builder and the strategy builder operates only under the "Managed Approach" (link below) which governs how orders are placed. It is possible that the orders are being placed but if the price is not hitting the limit type orders in the same bar they are submitted then the orders are automatically canceled. (You should also check the "Log" tab of the control center for any strategy generated error messages in case there is something else occurring).

    In order to "maintain" your stop and target limit type orders, you would have to resubmit them on each new bar until one or the other is hit.

    A way to do this would be to create two double-type variables to hold the stop and profit values. If you do not want these values to change for the duration of the trade then you would set the variables in the same set where the entry is made and this will store your stop and profit values. In another set, you would need to check that (using long entry as an example) the strategy is in a long position (see link below) and when that condition is true then submit your orders in that set. So as long as you are in a long position the orders are submitted on each bar. Once one or the other is hit then the condition (in a market position) is no longer true and the orders are no longer submitted.

    Note: It is also a good practice to check that the marketposition is flat in your entry sets as that will prevent your entry conditions from becoming true again while you are in a position potentially changing your stop and target!)

    References:
    https://ninjatrader.com/support/help...ionComparisons
    https://ninjatrader.com/support/help...d_approach.htm


    Last edited by NinjaTrader_PaulH; 09-24-2021, 08:01 AM.
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Hi Paul, great idea! I'll dig in, thx

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by burtoninlondon, Today, 12:38 AM
      0 responses
      5 views
      0 likes
      Last Post burtoninlondon  
      Started by AaronKoRn, Yesterday, 09:49 PM
      0 responses
      14 views
      0 likes
      Last Post AaronKoRn  
      Started by carnitron, Yesterday, 08:42 PM
      0 responses
      11 views
      0 likes
      Last Post carnitron  
      Started by strategist007, Yesterday, 07:51 PM
      0 responses
      13 views
      0 likes
      Last Post strategist007  
      Started by StockTrader88, 03-06-2021, 08:58 AM
      44 responses
      3,983 views
      3 likes
      Last Post jhudas88  
      Working...
      X