Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Start and end of regular session?

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

    Start and end of regular session?

    I am running 1 minute bar strategies against Nyse and Nasdaq instruments. I am in Arizona. Gathering information in the premarket and post market times and placing trades during regular trading hours.

    I have this code in my initialize routine:

    Code:
    [SIZE=1][SIZE=2]SessionData = [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"US Equities ETH"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];[/SIZE]
    [SIZE=2]CalculateOnBarClose = [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]true[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];[/SIZE][/SIZE]
    These properties seem to backtest fine. Do they look valid for live trading or do you see issues with them? I am trying to get around reconfiguring for daylight saving time. Just wondering if I am on the right track.

    Code:
    [SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]protected[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]bool[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] IsFirstBarOfRegSess { [/SIZE]
    [SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]get[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] {[/SIZE]
    [SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] (Bars.FirstBarOfSession && ToTime(GetEastStdTime(Time[0])) > 93000 && ToTime(GetEastStdTime(Time[0])) <= 103000) {[/SIZE]
    [SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]  return [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]true[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]; [/SIZE]
    [SIZE=2]}[/SIZE]
    [SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]else [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]return [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]false[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];[/SIZE]
    [SIZE=2]} [/SIZE]
    [SIZE=2]}[/SIZE]
     
    [SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]protected[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]bool[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] IsLastBarOfRegSess { [/SIZE]
    [SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]get[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] {[/SIZE]
    [SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] (Bars.LastBarOfSession && ToTime(GetEastStdTime(Time[0])) >= 133000 && ToTime(GetEastStdTime(Time[0])) <= 160000) {[/SIZE]
    [SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]  return [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]true[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];[/SIZE]
    [SIZE=2]}[/SIZE]
    [SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]else [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]return [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]false[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];[/SIZE]
    [SIZE=2]} [/SIZE]
    [SIZE=2]}[/SIZE]
    [SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]protected[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]bool[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] IsRegSess { [/SIZE]
    [SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]get[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]{ [/SIZE]
        [SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]return[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] (ToTime(GetEastStdTime(Time[0])) > 93000 && ToTime(GetEastStdTime(Time[0])) <= 160000); [/SIZE]
    [SIZE=2]} [/SIZE]
    [SIZE=2]}[/SIZE]
     
    [SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]protected[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]DateTime[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] GetEastStdTime([/SIZE][SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]DateTime[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] time) {[/SIZE]
    [SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af] TimeZoneInfo[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] EastStdInfo;[/SIZE]
    [SIZE=2] EastStdInfo = [/SIZE][SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]TimeZoneInfo[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].FindSystemTimeZoneById([/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"Eastern Standard Time"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);[/SIZE]
    [SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff] return[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]TimeZoneInfo[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].ConvertTime(time, EastStdInfo);[/SIZE]
    [SIZE=2]}[/SIZE]
    Thanks,
    Erik

    #2
    Hi Erik, the idea seems sound to me from a quick check.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    670 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    379 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    111 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    575 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    582 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X