Buying below a moving average
Author: aleehatami
Creation Date: 11/25/2009 5:53 PM
profile picture

aleehatami

#1
Hi, I am new to Wealth Lab and I have a couple of questions. I noticed when I am trying to enter in a price from a strategy it will wait for the OPEN or the CLOSE of the bar. If I am to run this strategy live, I need it to enter in as soon as it gets below a moving average (not at the close when it might have had a chance to get back up) Can I do this with wealthlab? In back testing it only buys at the open or close of the bar?

Also is there a way (I am a horrible coder) to avoid trading the first and last hour of the market?

Thanks in advance. Any help would greatly be apreciated!!

-Alee
profile picture

Cone

#2
QUOTE:
Can I do this with wealthlab?
I don't think we'd be in business if we couldn't!

QUOTE:
In back testing it only buys at the open or close of the bar?
It would only do that if you coded it that way.

QUOTE:
I need it to enter in as soon as it gets below a moving average
Use a BuyAtLimit order with a limit price below the moving average, e.g. movingAverageSeries[bar] - 0.01

QUOTE:
avoid trading the first and last hour of the market?
This is from the WL5Wiki Strategy FAQs. It should be pretty obvious how to modify it.

CODE:
Please log in to see this code.

profile picture

aleehatami

#3
Hey Cone thanks a lot! Is there any tutorial on how to do what you said with the movingAverageSeries[bar]? I don't think you can do it without manually coding it yourself right?

Thanks for the script on the time limit problem I had... works like a charm.
profile picture

Eugene

#4
Right, it's possible in code-based strategies.
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).