Elegant way to put in a trade any number of days after a signal.
Author: gbullr
Creation Date: 4/18/2010 10:48 PM
profile picture

gbullr

#1
Is there a way to buy at Limit any number of days after a signal has occurred. Lets say you want to buy a stock after it closes below a 30 day 2 stddev bolinger but only if closes below the crossunder days close less 7 pct at any time following the signal and for five days.

?

Something like

Signal
BuyAtLimit (bar+1, Close[bar]*.95,"Buy");
BuyAtLimit (bar+2, Close[bar]*.95,"Buy");
BuyAtLimit (bar+3, Close[bar]*.95,"Buy");
etc etc

Thanks.

And only execute the buy once not multiple buys.

Thanks.

profile picture

Eugene

#2
QUOTE:
BuyAtLimit (bar+1, Close[bar]*.95,"Buy");
BuyAtLimit (bar+2, Close[bar]*.95,"Buy");
BuyAtLimit (bar+3, Close[bar]*.95,"Buy");
...
And only execute the buy once not multiple buys.

Does it seem like a perfect pair of mutually exclusive statements?
profile picture

Eugene

#3
CODE:
Please log in to see this code.
profile picture

gbullr

#4
Eugene or Cone Help again... Thank you in advance

Cant get this to short if Close crosses over variable perlow * 1.10
CODE:
Please log in to see this code.
profile picture

Eugene

#5
You forgot to check for the "setup" to be false before going any further here:
CODE:
Please log in to see this code.

Instead, this code will work on a single bar only - not as intended.

I'd suggest reviewing my code above again and visiting this really helpful link:

Tutorial: Setups, Triggers, Delays, and Timeouts
profile picture

gbullr

#6
The problem w/ this is that it does not "reset" if there is a new 60 day close after the setup.

Is there a way to do that?
CODE:
Please log in to see this code.

profile picture

Eugene

#7
Yes there is - when you verified that "setup" is "true", set it to "false" when there is a new 60 day close.
profile picture

gbullr

#8
On an unrelated topic.

WL is freezing when I try to get external bars from yahoo.

So it executes the strategy but takes forever to compile results.

Suggestions? Thoughts.

I have reinstalled program and changed the data set so that should not be a problem.

Thanks.

profile picture

Eugene

#9
Create a Yahoo! DataSet, update it, disable on demand data updates.
profile picture

gbullr

#10
Regarding your prior suggestion of set it to false... I have no idea what you are talking about... Sorry between the 15 sets of brackets the !setups the setups and everything else, the whole thing makes no sense.

if the thing makes a 52 week high it should be a setup not while its !setup.
profile picture

Eugene

#11
There will be nothing complicated about it, if you study the code pattern itself:

Tutorial: Setups, Triggers, Delays, and Timeouts

"Setup" is "true" here:
CODE:
Please log in to see this code.

Here, you need to check for some condition like "new 60 day close" (btw I have no idea what's a "new 60 day close"), and if it's true, invalidate the "setup" (the code contains lots of examples.)
profile picture

gbullr

#12
Thanks on the yahoo data.

profile picture

gbullr

#13
Get the following error message on Dow 30 which I have not received before.
Error message for each symbol in dow 30.
Error processing symbol CAT Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index


CODE:
Please log in to see this code.





profile picture

Eugene

#14
Scroll down to Index was out of range in WL5 Wiki > Knowledge Base > Strategy errors.
profile picture

gbullr

#15
Fixed by restarting the program.
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).