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 Mindset, 04-21-2026, 06:46 AM
        0 responses
        89 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        135 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        68 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        119 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        69 views
        0 likes
        Last Post PaulMohn  
        Working...
        X