Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Enter position approximately 5 min before market close

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

    Enter position approximately 5 min before market close

    i am backtesting a strategy that is using market close as signal. Of course, enter position at market close would mean enter at the opening of following bar, but this would mean the price will have a big gap in following bar.

    To get the price that nearest to close price, i am considering to use a minute bar, and enter position, let's say, 5 min before market close.

    How is this possible in backrest?

    #2
    vhanded, I guess you're talking about daily data here? To simulate your setup you would then need to work via intraday data so you can submit the order at your desired timestamp.

    Comment


      #3
      Thanks for your reply, however, DateTime.now will always return my current device time, which means, the value cannot be used in backtest. Any solutions?


      Edit:
      I figure that I need to get the market closing time of an instrument. How can I obtain that?

      I thought I can use this:
      Instrument.MasterInstrument.Session.NextEndTime

      But the output is always 1/1/1800 12:00:00 AM

      Help.
      Last edited by vhanded; 02-13-2015, 01:18 AM.

      Comment


        #4
        I figured out I can do this:

        Code:
        DateTime sessionBegin;
        DateTime sessionEnd;
        Bars.Session.GetNextBeginEnd(Time[0], out sessionBegin, out sessionEnd);

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        122 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        68 views
        1 like
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        111 views
        2 likes
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        104 views
        1 like
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        83 views
        0 likes
        Last Post CarlTrading  
        Working...
        X