Buy at Market at certain time
Author: fairone99
Creation Date: 4/17/2016 10:02 PM
profile picture

fairone99

#1
HI!

I want to compare making a market buy at certain time during trading hours like 10:00 am, 10:30 am, and 11:00 am. I know I need to have the 30 mins scale price data which I have already downloaded.

So here comes the coding part... I am familiar with coding my strategy on the daily scale. How can I code a market buy at certain time after downloading the 30 mins scale pricing data?

I have checked around the Wiki and the programming reference and can not seem to find a direct reference.

Any help and suggestion on how to do the coding part is welcome. Or even a direction on pointing to the right place to find the reference will be great.

Thanks,


Alex
profile picture

Eugene

#2
Hi Alex,

Actually, the Wiki does have several examples showing how to buy at certain time of day as well as some downloadable strategies in WLP could be searched by keywords such as "hour" or "minute". See Intraday Support Functions in Community Components. In particular, GetTime is what you need. There's no reason to have a direct reference because date/time functions is an inherent part of the .NET framework and you can find everything you need in any C# 101 book or online resource (including those in the Wiki FAQ).
profile picture

fairone99

#3
Thank you, Eugene for the directions...

I did check out several useful intraday strategies from WLP itself.

However, Intraday Support Functions in Community Components and Wiki both are not accessible at this time for this reason:

QUOTE:
Error 404 - Web app not found.

The web app you have attempted to reach is not available in this Microsoft Azure App Service region. This could be due to one of several reasons:

1. The web app owner has registered a custom domain to point to the Microsoft Azure App Service, but has not yet configured Azure to recognize it. Click here to read more.

2. The web app owner has moved the web app to a different region, but the DNS cache is still directing to the old IP Address that was used in the previous region. Click here to read more.



Alex
profile picture

Eugene

#4
We're aware of the Wiki problem. Sorry for any inconvenience.

Meanwhile you can still view any Wiki page via Google cache. Just preface your search (e.g. for "Intraday Support Functions") with site:www2.wealth-lab.com (the domain where the Wiki is hosted) and click "Cached".
profile picture

fairone99

#5
Thank you, Eugene...

I have checked out the WiKi and it is working. Great!

I have read through some of the recommended documents and am still a bit confused.

Here, I attach the simple strategy that I wrote. This strategy is based on a Insider Buy strategy that you wrote a while back that comes with WLP.

Base on some insider buy activities, buy alerts are generated. Specially, my insider buy strategy alerts are triggered one day right after the insider's filing date. My current strategy is based on the daily scale and Russell 3000 symbols. There are about more than 200 lines of codes. However, most of them are for debugging purpose, so the real "working" codes are less than 100 lines.

Here, I would like to code it in a way that the market buy will be either triggered at 10:00 am, or 10:30 am, or 11:00 am versus the current buy at the market open...

Is it easy to code it to handle buy at market at 10:00 am, or 10:30 am, or 11:00 am which are based on 30 mins scale (not the current buy at market open, daily scale)?

I find it a bit difficult even after reading through these documents. Any help will be greatly appreciated. Maybe, a sample code base so that I can start to develop this from?

Thanks,


Alex
profile picture

Eugene

#6
For simplicity's sake, try out the "Daily strategy scheduling" option in the Strategy Monitor (in your strategy's properties).
profile picture

fairone99

#7
Thanks, Eugene...

However, the daily strategy scheduling option is for all the future trades.

If I can modify my existing code to generate market trades at 10:00 am, 10:30 am, or 11:00 am on 30 mins scale rather than on my current daily scale, than I can backtest the strategy against more than ten years data...

Maybe a sample base code from you? Thank you in advance.

Meanwhile, I will also dig more into these Intraday strategies and Wiki Intraday documents to get familiar with coding base on 30 mins scale.


Alex
profile picture

Eugene

#8
QUOTE:
Maybe a sample base code from you?

Sure, see links in post #2. I can not think of a more simple example than GetTime is - and which is already made more simplified than the .NET approach.
profile picture

fairone99

#9
Eugene,

Great and I have checked out the Community Component's GetTime in more detail and I think it will work... Thanks!

But, first, I need to download the Community Component Add On and then starts to download the Fidelity Static (Price) Data in 30 mins scale. Well, I think the whole process will take some time.

I will post the result back later.


Alex
profile picture

fairone99

#10
Thank you very much, Eugene and the code that you provided does work.


Alex
profile picture

Eugene

#11
Cheers!
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).