Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

creating an initial stop for backscan Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
pipeacosta
Posted : Monday, July 20, 2009 2:30:09 PM
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
Bruce_L
Posted : Monday, July 20, 2009 2:53:49 PM


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
pipeacosta
Posted : Monday, July 20, 2009 11:12:23 PM
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
Bruce_L
Posted : Tuesday, July 21, 2009 10:28:46 AM


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
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.