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 Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        633 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        364 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        105 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        567 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        568 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X