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 |

re: Stop Variation Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
curtmilr
Posted : Sunday, March 21, 2010 2:51:43 PM
Registered User
Joined: 2/26/2008
Posts: 10
Trainer,

      I'm trying to create:
 
a Stop that is activated by a Close below the Low of the Daily Bar with the Highest Traded Price in the last 8 Days.

   How can I do that????
Bruce_L
Posted : Monday, March 22, 2010 9:24:23 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
If the last 8 days includes today, try using the following RealCode Condition as an Exit Rule in BackScanner:

'|*****************************************************************|
'|*** StockFinder RealCode Condition - Version 4.9 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Condition:Stop Variation
'|******************************************************************
If CurrentIndex >= 7 Then
    Dim LowOfHigh As Single = Single.NaN
    For i As Integer = 0 To 7
        If Price.High(i) = Price.MaxHigh(8) Then
            LowOfHigh = Price.Low(i)
            Exit For
        End If
    Next
    If Price.Last < LowOfHigh Then
        Pass
    End If
Else
    SetIndexInvalid
End If

If the last 8 days ended yesterday, try using the following RealCode Condition instead:

'|*****************************************************************|
'|*** StockFinder RealCode Condition - Version 4.9 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Condition:Stop Variation
'|******************************************************************
If CurrentIndex >= 8 Then
    Dim LowOfHigh As Single = Single.NaN
    For i As Integer = 1 To 8
        If Price.High(i) = Price.MaxHigh(8, 1) Then
            LowOfHigh = Price.Low(i)
            Exit For
        End If
    Next
    If Price.Last < LowOfHigh Then
        Pass
    End If
Else
    SetIndexInvalid
End If

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
curtmilr
Posted : Monday, March 22, 2010 11:36:08 PM
Registered User
Joined: 2/26/2008
Posts: 10
Bruce,

   There must be an error in that Code, as there are no results showing up, even when you can manually "see" events that should trigger.

   Could you recheck it for me???
                                                                        Curtis
Bruce_L
Posted : Tuesday, March 23, 2010 7:21:50 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
I made a slight modification to both RealCode examples. Please try them again.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
curtmilr
Posted : Tuesday, March 23, 2010 9:44:19 AM
Registered User
Joined: 2/26/2008
Posts: 10
OK, Bruce. THAT works.

That's the problem in RealCode, of course. Sticky little details.

Now is it possible to be able to "paint" the action as it is actually used, as a Stop? In other words, only showing the first instance of the circumstance?

If not, I understand, but it sure would make the charts cleaner and easier to read. This type Real Code technique, to limit repetiton of circumstance painting, that I would incorporate into all SF Rules.

Thanks for your efforts.
                                     Curtis
Bruce_L
Posted : Tuesday, March 23, 2010 4:06:18 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
How you eliminate "repetition" depends on what is meant by the term and the particular Rule (which can affect what is meant by "repetition").

In it's simplest definition, "repetition" would just eliminate the Rule from returning True more than one Bar in a Row. What is normally meant however is the first time something has occurred since something else.

In the case of say Price being above a Moving Average versus crossing up through a Moving Average, this is fairly simple. You are looking for the first time it is above the Moving Average since it was below the Moving Average.

Your example is more complicated however. As a Stop in a trade, it would be fairly simple in that you would be looking for the first time it is True since entering the position. But as a standalone Rule that is not aware of a trade, you are probably looking for the first time the Close was below the Low of the Highest Bar in the last eight days until there is another Highest Bar in the last eight days (although it could be since something else):

'|*****************************************************************|
'|*** StockFinder RealCode Condition - Version 4.9 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Condition:Stop Variation
'|******************************************************************
If CurrentIndex >= 8 Then
    Static Bar As Integer
    Static First As Boolean
    If isFirstBar Then
        Bar = -1
        First = False
    End If
    Dim LowOfHigh As Single = Single.NaN
    For i As Integer = 0 To 7
        If Price.High(i) = Price.MaxHigh(8) Then
            LowOfHigh = Price.Low(i)
            If Bar <> CurrentIndex - i Then
                First = True
                Bar = CurrentIndex - i
            End If
            Exit For
        End If
    Next
    If First = True AndAlso _
        Price.Last < LowOfHigh Then
        Pass
        First = False
    End If
Else
    SetIndexInvalid
End If

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
curtmilr
Posted : Tuesday, March 23, 2010 8:12:30 PM
Registered User
Joined: 2/26/2008
Posts: 10
Bruce,

   That looks to do EXACTLY what I intended. THANKS!!

                         Curtis
Bruce_L
Posted : Wednesday, March 24, 2010 8:04:39 AM


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.