Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Immediately Place Order when Strategy Enabled

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

    Immediately Place Order when Strategy Enabled

    I want to place an order immediately above/below previous bar when I enable the strategy. However, it sometimes makes me wait for a new bar, or doesn't place order at all.

    I've tried changing the 'StartBehavior' but nothing happens.


    if (Position.MarketPosition == MarketPosition.Flat)
    {
    if (High[0] - Low[0] <= (50*TickSize))
    {
    EnterShortStopLimit(2, (Low[0] - (2 * TickSize)) , (Low[0] - (1 * TickSize)) , @"SE1");
    EnterShortStopLimit(1, (Low[0] - (2 * TickSize)) , (Low[0] - (1 * TickSize)) , @"SE2");
    EnterShortStopLimit(1, (Low[0] - (2 * TickSize)) , (Low[0] - (1 * TickSize)) , @"SE3");
    }


    Thank you!!!!

    #2
    Hi elcowen, thanks for posting. If you want to do this on the first real time bar, put this code at the top of OnBarUpdate:

    if(State == State.Historical)
    return;

    Also make sure "EntriesPerDirection" is set to at least 3 to accommodate the three entry orders.

    Kind regards,
    -ChrisL

    Comment


      #3
      Chris good catch on the Entries/Direction... thank you!

      My strategy is still waiting for the start of a new candle before sending an order.

      If I said Calculate.EachTick then used High[1] (instead of High[0]) would that send the order immediately?

      Thanks,

      Comment


        #4
        Hi elcowen, Is the strategy running in a backtest with these orders or are they real time orders? If you see it in the backtest the strategy needs intrabar granularity. See this post explaining the concept:

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        67 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 05-10-2026, 08:12 PM
        0 responses
        41 views
        0 likes
        Last Post CarlTrading  
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        202 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Started by CaptainJack, 04-24-2026, 11:07 PM
        0 responses
        366 views
        0 likes
        Last Post CaptainJack  
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        284 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Working...
        X