Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 3/26/2005 Posts: 18
|
I have been having fun backtesting different stop losses with daily data in SF but finally noticed that the system was automatically re-entering the trade 1 bar after being stopped out.
As I used to understand it, a stop loss was properly implemented in the following typical sequence:
1) The trade is entered when required conditions are met ("setup");
2) Trade is exited when price falls X% below entry price;
3) At some point, the required entry-setup conditions no longer exist.
4) Entry-setup conditions are present again and a new trade is initiated.
In this sequence, you are out of the market between 2) and and 4). If you use the stop-loss rule provided in Backscanner on the pull-down menu for Trade-Based Rules, SF enters a new trade one bar after exiting at 2) whenever the required entry conditions are still present. I have tried several ways to change the way the SF stop loss works, including different types of sequences, to no avail. One obstacle I found was that trade-based rules can't be added to a Sequence.
Any ideas?
mick
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You could Drag and Drop your Entry Rule (the Chart Rule, not the BackScanner Rule) into the RealCode Editor to create something similar to the first line of the following RealCode Rule which you could then use as an Entry Rule in BackScanner (the actual variable name assigned to the Rule might be different, just use it instead of MR throughout the RealCode):
'# MR = condition.MyRule
If MR.Value = True AndAlso _
MR.Value(1) = False Then Pass
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 3/26/2005 Posts: 18
|
Thanx Bruce
It seems to work.
Some Qs since I am not familiar with Realcode and can't find in the manual:
What is the purpose of "_" after AndAlso? It seems to compile ok without.
Is it realy necessary to use caps for "True", "False", "AndAlso" etc?
mick
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
The underscore is a line continuation character that means the following physical line is part of the same logical line. It should not compile fine without it (unless you take the next line and make it physically part of the line as well). You should get error messages listed below the RealCode.
It is not necessary to use caps. I just do so by habit.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 3/26/2005 Posts: 18
|
Thanx a lot Bruce. I think I have it working now.
mick
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You're welcome.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Guest-1 |