Download software Tutorial videos
Subscription & data-feed pricing Class schedule


New account application Trading resources
Margin rates Stock & option commissions

Attention: Discussion forums are read-only for extended maintenance until further notice.
Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

How to create "conventional" stop loss Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
meast
Posted : Sunday, January 3, 2010 9:44:24 PM
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
Bruce_L
Posted : Monday, January 4, 2010 11:50:01 AM


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
meast
Posted : Saturday, January 16, 2010 5:53:02 PM
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
Bruce_L
Posted : Monday, January 18, 2010 10:39:56 AM


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
meast
Posted : Wednesday, January 20, 2010 3:59:09 PM
Registered User
Joined: 3/26/2005
Posts: 18
Thanx a lot Bruce.  I think I have it working now.
mick
Bruce_L
Posted : Wednesday, January 20, 2010 4:00:15 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
You're welcome.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Users browsing this topic
Guest-1

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.