Download software Tutorial videos
Subscription & data-feed pricing Class schedule


New account application Trading resources
Margin rates Stock & option commissions

Attention: Discussion forums are read-only for extended maintenance until further notice.
Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

Help with coding intraday price conditions Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
blocksworks
Posted : Tuesday, August 21, 2007 3:02:34 PM
Registered User
Joined: 8/14/2007
Posts: 34
Would someone please kindly show me how to set the following up in Blocks Mega Minute?

I want to buy at the open of next bar if...

the close at 10:00am is greater than the close at 9:45am.

Craig_S
Posted : Tuesday, August 21, 2007 7:27:31 PM


Worden Trainer

Joined: 10/1/2004
Posts: 18,819
We are trying some ideas out. I will let you know what we come up with.

- Craig
Here to Help!
bobre1
Posted : Wednesday, August 22, 2007 7:29:22 AM
Registered User
Joined: 10/7/2004
Posts: 886
Hi Jared. I ran this scan on all US Stocks over the last 3 months, and the scan returned no stocks.

I have MegaMinute, and loaded the scan strategy as posted with no changes.

IS there some setting I might be overlooking? I haven't checked in detail, but I would certainly think at least one stock would have satisfied the intent of the strategy.

Thanks,
Bob
Craig_S
Posted : Wednesday, August 22, 2007 8:44:58 AM


Worden Trainer

Joined: 10/1/2004
Posts: 18,819
No.

Jared's attempt has a few logic errors in it that are not easily apparent. We are still working on a solution.

- Craig
Here to Help!
Jared_C
Posted : Wednesday, August 22, 2007 8:48:18 AM

Worden Trainer

Joined: 10/7/2004
Posts: 74
Hello All,

There was a problem with the last scan that I posted. It was a mistake on my part, and I apologize. I will correct it and post a new scan.
Kuf
Posted : Wednesday, August 22, 2007 12:35:15 PM


Administration

Joined: 9/18/2004
Posts: 3,522
We had to write a new code block for this to work but it has now been included in the worden code block library (it will automatically be updated when you run the software).

I've attached a strategy with the conditions you requested. Change the sell signal to your liking.

Download the attached file to My Documents\Blocks Files\Tool Parts\Strategies

Attachments:
Buy Next Day after 10 above 9-45.bscan - 12 KB, downloaded 657 time(s).



Ken Gilb (Kuf)
Chief Software Engineer - Worden Brothers Inc.
Try/Catch - My RealCode Blog
blocksworks
Posted : Wednesday, August 22, 2007 7:05:57 PM
Registered User
Joined: 8/14/2007
Posts: 34
Hi Ken,

Thank you so much for creating a new code block just for this. You guys are so responsive; I am impressed.

Just one question... I ran the strategy on S&P 500 components watchlist for all history and got no trades. It seems strange that this condition did not produce any signals. Would you mind taking another look at your code again and tell me why that's so?

I appreciate it.

J
StockGuy
Posted : Wednesday, August 22, 2007 10:10:34 PM

Administration

Joined: 9/30/2004
Posts: 9,187
Make sure the Strategy Time Frame is set to 1 minute and see if that works.

I tweaked the second condition to 10:01am.

The scan produced 1233 trades in the last 3 months on the Nasdaq 100 components.

Attachments:
Buy Next Day after 10 above 9-45.bscan - 11 KB, downloaded 625 time(s).

bobre1
Posted : Thursday, August 23, 2007 9:00:21 AM
Registered User
Joined: 10/7/2004
Posts: 886
Isn't the logic of the strategy incorrect, according to what blocksworks wanted to do?

I think blocksworks wanted to buy at the open of the 10:01 bar if the close of the 10:00 bar was above the close of the 9:45 bar.

The strategy conditions first check if the 10:00 price was above the 9:45 price, AND THEN time of day is 9:31 (I believe).

That means the trade would execute on the following day, not the next minute bar (10:31). no?

I don't think the "and then" condition is necessary, is it?

Thanks
Bob
Kuf
Posted : Thursday, August 23, 2007 9:11:29 AM


Administration

Joined: 9/18/2004
Posts: 3,522
Ah my mistake, I thought he wanted to buy on the open of the next day.

All you need to do is remove second condition and change the strategy settings to buy on the open of the next bar.

Here's the updated scan. Make sure you change the timeframe to 1 minute.

Attachments:
Buy Next Bar after 10 above 9-45.bscan - 9 KB, downloaded 637 time(s).



Ken Gilb (Kuf)
Chief Software Engineer - Worden Brothers Inc.
Try/Catch - My RealCode Blog
bobre1
Posted : Thursday, August 23, 2007 9:52:57 AM
Registered User
Joined: 10/7/2004
Posts: 886
Is there a way to display; 1) the current time in a legend display (which updates), and 2) the intraday time of the date pointer?

Thanks,
Bob
StockGuy
Posted : Thursday, August 23, 2007 9:59:38 AM

Administration

Joined: 9/30/2004
Posts: 9,187
Right click on the date pointer and select Properties. Set the Text Format to M/d/yy hh:mm.
bobre1
Posted : Thursday, August 23, 2007 10:06:47 AM
Registered User
Joined: 10/7/2004
Posts: 886
ahh... thanks StockGuy. It might be nice to use a drop down list with formats for that in the properties window.

What about displaying current time? The "Date.Now" block says it includes the time, but I don't see how to parse the time data.

Thanks,
Bob
StockGuy
Posted : Thursday, August 23, 2007 10:12:18 AM

Administration

Joined: 9/30/2004
Posts: 9,187
I added a data display to the toolbar and used the following blocks to display date/time.

Date.Now-> Date Text Format -> Data to Display

A parameter block comes along with the Date Text Format block. Set it's Value to MM/dd/yy hh:mm:ss
bobre1
Posted : Thursday, August 23, 2007 10:23:45 AM
Registered User
Joined: 10/7/2004
Posts: 886
Got it! Thank you.

Bob
Users browsing this topic
Guest-1

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.