Multi-Time Frame Trading Strategy with Bollinger Bands
Author: NoelG80
Creation Date: 12/10/2014 7:33 AM
profile picture

NoelG80

#1
Hi,

i would like to create a trading strategy in Wealth Lab and have unfortunately no idea, how to code it.

The Setup is as follows:

The time-frames should be daily and weekly. In both time-frames the bollinger bands with 20 periods and a Standard Deviation of 2.0 are the indicators chosen. In addition the Simple Moving Average with 20 periods is also used as an indicator in both time-frames.

The Strategy should now trade as follows:

BUY when the Price is BELOW the lower Bollinger Band on DAILY Basis AND the Price is ABOVE the SMA 20 on WEEKLY Basis.

SELL when the Price is ABOVE the upper Bollinger Band on DAILY Basis AND the Price is BELOW the SMA 20 on WEEKLY basis.


Is it possible to code such a strategy?


If you have any further questions, please do not hesitate to ask and many thanks in advance for your help.


Greetings,

Steffen

profile picture

Cone

#2
Sure it's possible, piece of cake. There's even a pretty good example for you in the WealthScript Programming Guide > Multi-Time Frame Analysis > Daily/Weekly

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

NoelG80

#3
Thanks Cone for the very fast and superb help. This really helps me out.

As I forgot something, i got one last question:

How can I code exit parameters like e.g. a Profit Target of 20 % and a Stop Loss at 10 % in both of the strategies?


I tried it out with the examples on the Programming Guide, but I can't make it working.


Thanks again in advance. I appreciate your help very much.


Greetings,

Steffen


profile picture

Eugene

#4
QUOTE:
How can I code exit parameters like e.g. a Profit Target of 20 % and a Stop Loss at 10 % in both of the strategies?


Here's how:

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

NoelG80

#5
This works perfect! Thanks again for your very fast and excellent help!
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).