Hey, I am a newcomer of Wealth-Lab Developer 5. In order to get a total picture of what Wealth-Lab Developer can, I take a easy start by beginning with rule-based strategy building. I tried to include the following statements in a single rule-based strategy.
Enter at market price when MA 50 crosses above MA 200
Sell at market price when MA 50 crossed below MA 200
Trailing stop 8%
Re-enter the market at market price when price goes up 8%
It is very easy to over the first 3 statements in the strategy. For the last statement, I could not find any conditions I can use to make it work the way it should. Can any one with great Wealth-Lab experience give me a help. Thanks.
Best Regards, BA Hsieh
Size:
Color:
Not sure if rules would allow this, but it's a piece of cake with code-based strategies. I added parameters to control the number of re-entries allowed and trailing stop percentage, check it out --
CODE:
Please log in to see this code.
Size:
Color:
Dear Eugene,
Thank you very much for your quick help. Right after reading your Wealth-Lab scrip, I decide to take a quick start on C# programming. But before anything else, I would still like to know what Wealth-Lab can do with "code" programming. With only a week's experience, now I roughly know rule-base strategy is probably not the right tool if the strategy involves complicated logical flow.
I think I did not describe my strategy well enough and the program ended up with an unexpected result. Now let me make it more clear.
IF MA50 crosses above MA200
Buy at Market Price
Else If MA50 crosses below MA200
If position is still open
Sell at Market Price
Endif
Endif
If Market Reaches Trailing Stop 8%
Sell at Market Price
Endif
If MA50 is above MA200
If there is no open position
If Market goes back up to latest peak
Buy at Market Price
Endif
Endif
Endif
Do you think it is easy to use Wealth-Lab Script and C# to handle the above logic?
Best Regards, BA Hsieh
Size:
Color:
QUOTE:
Do you think it is easy to use Wealth-Lab Script and C# to handle the above logic?
Yes, when you fix a flaw in the logic:
QUOTE:
If MA50 is above MA200
If there is no open position
If Market goes back up to latest peak
Buy at Market Price
Endif
Endif
Endif
This entry isn't paired with an exit to close the position.
Size:
Color:
Dear Eugene,
Thanks again for your quick help. The purpose of my last block of statements is simply to make sure I re-enter the market if I get stopped out and the market revers later on. Consequently, I do not need a "Sell" statement here. If MA50 is already below MA200, the position must have already been sold under "Else If MA50 crosses below MA200". If there is still open position, I do not need to re-enter. If market does not go back to the latest peak, I need to do nothing either. Thanks again for your time and great help.
Best Regards, BA Hsieh
Size:
Color:
QUOTE:
Consequently, I do not need a "Sell" statement here. If MA50 is already below MA200, the position must have already been sold under "Else If MA50 crosses below MA200".
It could be closed by the trailing stop as well.
QUOTE:
If there is still open position, I do not need to re-enter.
And when it's time to re-enter with "If MA50 is
above MA200...", your primary condition,
"IF MA50
crosses above MA200..", has already triggered. So, your re-entry rule as we know it only has a chance to trigger while the first condition is active.
Size:
Color: