Multiple indicator confirmation
Author: praktikus_wl
Creation Date: 4/23/2014 12:50 PM
profile picture

praktikus_wl

#1
I am try to code a simple system for trading long only (like IRA accounts). It consists of four indicators:

- SMA Envelope 25 / 2%; Close above upper envelope
- Slow Stoch 30/2, no signal line; cross above 50
- MACD 5/25/1, made from EMA 5 and EMA 25; cross short EMA above long EMA
- Aaron 8; Aaaron up = 100

If three of those four triggers are met, I want to enter long, vice versa if three out of four are negative I want to exit long (later I want to expand this strategy for testing purposes to go short instead of exit).

The only way to get this in WL seems to be (pseudo code)

if trigger 1 and trigger 2 and trigger 3
or if trigger 1 and trigger 2 and trigger 4
or if trigger 1 and trigger 3 and trigger 4 ...


In my old software, this was easier to be done, that is why I ask if there is no shorter way (still learning C#).

Each trigger that was met returned true (1), so it was done like this (pseudo code)

Trigger 1
Trigger 2
Trigger 3
Trigger 4
If Sum (of Triggers) >=4, Enter Long


Sorry for my bad english, if I left something unclear please ask.

Thanks, Martin
profile picture

Eugene

#2
Martin,

You can reach this quite easily:

1. In Rule-based Strategies, with Multi-Condition Group feature. See the Wealth-Lab User Guide > Strategy Window > Strategy Builder > MC, Multi-Condition Group.

2. In code-based Strategies, simply make your Trigger(...) an integer variable and count the number of occurrences on a given bar. In pseudocode:

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

Eugene

#3
To anybody interested in MC Groups. Check out our tutorial video on Youtube:

Wealth-Lab 101: Strategy Builder Multi-Condition Groups
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).