Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Exit and entry in the same bar

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

    Exit and entry in the same bar

    I have a strategy that can exit from de actual position and send a new order in the same bar for a new trader (or close a position and send a entry order in de the same bar). For example, there is a long position openned and it's necesary to close this position and then to send a StopOrder for a new posibility. I know the property "Entries per direction" but it is only for entries and I need to close a position and to send a order for new trade in the same bar. How can I do it?
    Thanks in advance.

    #2
    Originally posted by soyjesus View Post
    I have a strategy that can exit from de actual position and send a new order in the same bar for a new trader (or close a position and send a entry order in de the same bar). For example, there is a long position openned and it's necesary to close this position and then to send a StopOrder for a new posibility. I know the property "Entries per direction" but it is only for entries and I need to close a position and to send a order for new trade in the same bar. How can I do it?
    Thanks in advance.

    There are a few ways.
    1. Use OnBarUpdate() to set flags for what your entry condtion should be, then use OnMarketData() to place the orders, depending on the value of the flags. That means, of course, that you cannot backtest or optimize, unless you do it manually using Market Replay.
    2. Use COBC = false.
    3. Use a multi-timeframe setup, and make orders using the barSeries with finer granularity.
    Just remember that the first 2 methods will be pretty processor-intensive, as they are going to be processing every tick that comes in, instead of just once per bar.
    Last edited by koganam; 04-01-2012, 06:40 PM. Reason: Corrected grammar

    Comment


      #3
      Koganam,

      thank you very much for your help!

      But as you write the first 2 methods are more cpu-intensive, therefore I use the COBC=true.

      With the multidataseries I know I have 5 add(...) I would understand but this is not how I have to do it.

      Do you know how one can do in the script so that the "flat-condition" is in OnExecution but this work "together" with OnBarUpdate-conditions? Maybe to put all conditions to OnExecution? Or how to refer from one to other? "Conditions in onbarupdate and flat in onexecution, then do...."

      Thank you
      Tony

      Originally posted by koganam View Post
      There are a few ways.
      1. Use OnBarUpdate() to set flags for what your entry condtion should be, then use OnMarketData() to place the orders, depending on the value of the flags. That means, of course, that you cannot backtest or optimize, unless you do it manually using Market Replay.
      2. Use COBC = false.
      3. Use a multi-timeframe setup, and make orders using the barSeries with finer granularity.

      Just remember that the first 2 methods will be pretty processor-intensive, as they are going to be processing every tick that comes in, instead of just once per bar.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      571 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      330 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      101 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      548 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      549 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X