• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

time based order entry

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

    time based order entry

    Hello. I'm currently working in Unmanaged framework. Based on various signals, the strategy generates buys or sells, and each order effectively has a stop and profit target associated with it. However, I would like to add a condition such that if after a given amount of time the stop or profit target hasn't been hit, then I close that particular trade. For example,suppose I buy one unit. If after 24 periods the stop or profit target hasn't been reached, then I would like to sell that unit. Does anyone have any examples of this?

    #2
    Hello stewarco,

    Thank you for your note.

    What you could do is save the current bar plus 24 to a variable when you enter a position, then later in the script check if the current bar is greater than that variable, and if so exit the position.

    I’ve put together a snippet of how you could do this in the managed approach, to do this in the unmanaged approach you’d just swap the managed order methods with the unmanaged order methods.

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

    Comment


      #3
      Originally posted by stewarco View Post
      Hello. I'm currently working in Unmanaged framework. Based on various signals, the strategy generates buys or sells, and each order effectively has a stop and profit target associated with it. However, I would like to add a condition such that if after a given amount of time the stop or profit target hasn't been hit, then I close that particular trade. For example,suppose I buy one unit. If after 24 periods the stop or profit target hasn't been reached, then I would like to sell that unit. Does anyone have any examples of this?
      BarsSinceEntryExecution()?

      ref: https://ninjatrader.com/support/help...yexecution.htm

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by borjanews, Yesterday, 06:13 PM
      2 responses
      11 views
      0 likes
      Last Post borjanews  
      Started by Austiner87, Yesterday, 04:58 PM
      1 response
      2 views
      0 likes
      Last Post NinjaTrader_ChrisSch  
      Started by Gerik, Today, 12:53 AM
      0 responses
      4 views
      0 likes
      Last Post Gerik
      by Gerik
       
      Started by teafortwo, Yesterday, 04:26 AM
      4 responses
      13 views
      0 likes
      Last Post bltdavid  
      Started by Austiner87, Yesterday, 05:13 PM
      0 responses
      2 views
      0 likes
      Last Post Austiner87  
      Working...
      X