Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 4/12/2008 Posts: 41
|
I want to create an Initial stop for backscan, but its a little bit tricky because it has a swing low involved.1. I have X rule to Buy at the next open.2. I want backscan to sell all the position if: The price falls through the PREVIOUS (from the buy signal) swing low.For swing low im using this rule:If Price.Low(-5) > Price.Low AndAlso _ Price.Low(-4) > Price.Low AndAlso _ Price.Low(-3) > Price.Low AndAlso _ Price.Low(-2) > Price.Low AndAlso _ Price.Low(-1) > Price.Low AndAlso _ Price.Low(1) > Price.Low AndAlso _ Price.Low(2) > Price.Low AndAlso _ Price.Low(3) > Price.Low AndAlso _ Price.Low(4) > Price.Low AndAlso _ Price.Low(5) > Price.Low Then Pass 3. Help Thanks
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
As mentioned in the syntax for a swing high topic, you shouldn't be using Rules that reference future Values in BackScanner. You should probably be using something like the following RealCode Rule as your Buy Signal instead:
If Price.MinLow(5) > Price.Low(5) AndAlso _
Price.MinLow(5, 6) > Price.Low(5) Then Pass
If you follow this advice, something like the following RealCode Rule would return True if the current Low was below the most recent swing low but would have no way of knowing if the swing low being tested against was the swing low that triggered the Buy or not:
Static InitStop As Single
If isFirstBar Then
InitStop = Single.NaN
End If
If Price.MinLow(5) > Price.Low(5) AndAlso _
Price.MinLow(5, 6) > Price.Low(5) Then
InitStop = Price.Low(5)
End If
If Price.Low < InitStop Then
Pass
InitStop = Single.NaN
End If
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 4/12/2008 Posts: 41
|
There was little sintax error in : "Price.MinLow(5, 6) < Price.Low(5) Then" it should be > instead of <. The rest worked perfectly.
Do you guys have a video explaining how Static InitStop works ???? If not, could you teach me ?
Thanks
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
QUOTE (pipeacosta) There was little sintax error in : "Price.MinLow(5, 6) < Price.Low(5) Then" it should be > instead of <. The rest worked perfectly.
Corrected above. Thanks.
QUOTE (pipeacosta) Do you guys have a video explaining how Static InitStop works ???? If not, could you teach me ?
It's just a statement that creates a variable called InitStop. It's no different than creating any other variable. The variable name has no special use within BackScanner and was just chosen because it was descriptive of its purpose within the RealCode.
The RealCode Programmers Reference has sections on declaring and using variables.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Guest-1 |