"Stop and Reverse on Same Bar" in the Strategy builder
Author: chenwen007
Creation Date: 12/17/2009 9:38 AM
profile picture

chenwen007

#1
I am a newbie and testing a simple strategy which is based on # of days consecutive up/down on SMA: long and hold pos if SMA is up and switch to short after SMA is down # days. This can be built easily in the Builder for a single open pos, however I note the reversal trade is not on the same day. Instead it is entered on the next day. Intention is to reverse on the same bar. How can it be done in the Builder?? Thanks for any advice.

Below is full code from Builder.

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

Eugene

#2
Hi again Steven,

Here's the answer to your question: How to create a stop-and-reverse system in a Rule-based Strategy? in the Wealth-Lab 5 Wiki FAQ.

P.S. Note the CODE button - it nicely formats your code when it's pasted in between those tags. Do you see (I edited your post)?
profile picture

chenwen007

#3
Hi:
Sorry forget to mention that selecting "Multiple open positions allowed" will not work on this test strategy b/c it will generate many trades as there are many cases where SMA is up or down consecutively. The strategy only switches long when having 5 conse. downs or short when having 5 conse. ups.
Any chance to restore SAR as a default setting to the Builder since many people are asking such? Or any easy way to modify the code to achieve the same outcome. Thanks.
profile picture

Eugene

#4
QUOTE:
Or any easy way to modify the code to achieve the same outcome.

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

chenwen007

#5
Thanks. It works.
Another question: I tested it with $10,000 or $100,000 in portfolio mode with 100% equity, the results are comparable with all trades included. Yet when I used $1,000,000 capital, the 3rd trade is not included due to insufficient simulated capital (strategy lost 8% in the first two trades). I do not see how $1mm is not enough capital vs $10k or $100k. Do I miss something obvious? Please advise.
profile picture

Eugene

#6
See Strategy Window > Backtesting Strategies > 100% of Equity Sizing in the User Guide.