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 NullPointStrategies, Today, 05:17 AM
        0 responses
        51 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        127 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        69 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        42 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        46 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X