Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Close position within the current candle

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

    Close position within the current candle

    Hello,

    I use in my strategy the 60 minutes timeframe

    The EXIT is defined as follows:

    //2.4 Short profit:

    if (Position.MarketPosition == MarketPosition.Short

    && GetCurrentBid() <= Position.AvgPrice - Gain3 * TickSize)

    {
    ExitShort("PT-ShortTA3", "Short3");
    }

    The (bid-) price touches the defined exit price, but nothing happens.
    The position is closed at the opening price of the next candle.

    What I need to change that closing of this position within the current candle is carried out?

    #2
    Hello,

    Thank you for the question.

    I would like to ask for some specifics on how you are running this currently.

    Was this in realtime data or backtest?

    Also what is the strategies CalculateOnBarClose set to, true or false?

    I look forward to being of further assistance.

    Comment


      #3
      Hello Jesse,

      I´m using realtime data und CalculateOnBarClose set to true.

      Comment


        #4
        Hello Blackburn,

        With Calculate on bar close set to true, the order is not submitted until the beginning of the next bar, so your strategy is working correctly.

        If you want the order to submit immediately, you will want to either run the strategy with CalculateOnBarClose set to false (for realtime), or submit the order to an added 1 tick data series (usually used for backtesting). An example of submitting orders to an additional data series can be found on our forums here: http://ninjatrader.com/support/forum...ead.php?t=6652

        Please let me know if you have any questions or if I may be of further assistance.
        Michael M.NinjaTrader Quality Assurance

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        144 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        71 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        125 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        79 views
        0 likes
        Last Post PaulMohn  
        Working...
        X