- ago
How does WL calculate the pre and post-market timings? The class MarketDetails seems to have these properties IsPreMarket and IsPostMarket but has no way of specifying them.

Is there a way for a custom adapter to specify the pre and post market timings?
0
99
5 Replies

Reply

Bookmark

Sort
- ago
#1
It's driven by Tools > Markets & Symbols.

The mechanics including symbol matching is documented in the Help (F1).
0
Cone8
 ( 23.82% )
- ago
#2
.. but there's a priority that goes like this:
First, if a symbol is defined or is matched in Markets & Symbols, that Market (and market hours) are assigned to the BarHistory. Otherwise, the Historical Provider may assign the market for the symbol - each provider has it's own way to do it. If it can't determine the market, the default is U.S. Stocks.
0
- ago
#3
I couldn't find the info that I need in the Markets & Symbols documentation.

I am creating a custom data adapter for Indian Market. I am creating a MarketDetails object in code and adding it using MarketManager. I am able to assign the market hours - Open & Close timings.

However, what I could not find is a way to specify the pre-market hours and post-market hours. In India, we have 30 minutes before the actual market open time, during which only some operations are allowed. It is called Pre-market hours.

Does Pre-Market hours in WealthLab mean "12:00 AM till Market Open time on a certain date"? If YES, then I have my answer for the original question. If NOT, then where can I specify - "Pre-market time is 30 minutes before the market open"?
0
Glitch8
 ( 10.06% )
- ago
#4
We currently don’t have defined pre and post market times. Like you said, pre market is midnight until open time. Post market is closing time until midnight.

Looking forward to seeing your extension if you choose to offer it publicly!
0
Cone8
 ( 23.82% )
- ago
#5
QUOTE:
Does Pre-Market hours in WealthLab mean
We consider anything that doesn't happen during regular market hours as "Pre/Post Market".

For normal day markets, pre market is anything that happens before the open.
Why don't you just use the Market opening time and subtract 30 minutes?

Where do you specify it? - In C# code by accessing the market hours.

CODE:
using WealthLab.Backtest; using System; using WealthLab.Core; using WealthLab.Data; using WealthLab.Indicators; using System.Collections.Generic; namespace WealthScript123 {    public class MyStrategy   : UserStrategyBase    {              public override   void Initialize(BarHistory bars)       {          _openTime =   bars.Market.GetOpenTimeMarketTime(true).TimeOfDay;       }              public override   void Execute(BarHistory   bars, int idx)       {          bool IsPremarket = bars.DateTimes[idx].TimeOfDay < _openTime;                    if (IsPremarket)          {             // do something   premarket          }                 }       TimeSpan _openTime;       } }
0

Reply

Bookmark

Sort