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
Size:
Color:
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.
Size:
Color:
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
Size:
Color:
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.
Size:
Color:
This works perfect! Thanks again for your very fast and excellent help!
Size:
Color: