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 |

Low Since 63 Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
thnkbigr
Posted : Tuesday, August 4, 2009 3:06:20 PM
Platinum Customer Platinum Customer

Joined: 3/31/2006
Posts: 3,207
Bruce 

The formula below will plot how far the stock has dropped from its last 63 day high in %.

This is what I need to adjust and I can't get it to work right no matter what I do.

If today is a 63 day high and highest price reached was 10 and the low of today is 7.50 which means the stock ran 33%, the value of this indicator today will read -25% ((10-7.50)/10) indicating that the stock has corrected by 25% since high which is not correct. It looks at how far todays low is comparing to todays high.

What I need is to ignore is the low of the day that we hit a high and look at the low from the day after the 63 day high. So if the next days low was 9.50 price only dropped 5% from the 63 day high of 10. 

We need to skip the low on the the day that we hit the 63 day high.

Thanks

Static Count As Integer
Static Trigger As Boolean
If isFirstBar Then
 Count = 0
 Trigger = False
End If
If CurrentIndex >= 64 Then
 If Price.High > Price.MaxHigh(62, 1) Then
  Count = 0
  Trigger = True
 End If
End If
Count += 1
If Trigger Then
 Plot = Price.MaxHigh(Count) - Price.MinLow(Count)
Else
 Plot = Single.NaN
End If
Bruce_L
Posted : Tuesday, August 4, 2009 4:12:45 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
QUOTE (thnkbigr)
If today is a 63 day high and highest price reached was 10 and the low of today is 7.50 which means the stock ran 33%, the value of this indicator today will read -25% ((10-7.50)/10) indicating that the stock has corrected by 25% since high which is not correct. It looks at how far todays low is comparing to todays high.

You have no idea if it is correct or not actually since you have no idea which came first, the High or the Low of the Bar.

QUOTE (thnkbigr)
What I need is to ignore is the low of the day that we hit a high and look at the low from the day after the 63 day high. So if the next days low was 9.50 price only dropped 5% from the 63 day high of 10.

On the day of the High, Price has at least dropped as far as the Close of the current day and possibly as far as the Low of the current day, but it most certainly hasn't dropped to the Low of the next day. If you want to use the Low of the next day, you should wait until the next day to start returning values.

Static Count As Integer
Static Trigger As Boolean
If isFirstBar Then
    Count = 0
    Trigger = False
End If
If CurrentIndex >= 64 Then
    If Price.High(1) > Price.MaxHigh(62, 2) Then
        Count = 0
        Trigger = True
    End If
End If
Count += 1
If Trigger Then
    Plot = Price.MaxHigh(Count + 1) - Price.MinLow(Count)
Else
    Plot = Single.NaN
End If

QUOTE (thnkbigr)
We need to skip the low on the the day that we hit the 63 day high.

If you are going to start returning values on the day of the High, you might want to make a comparison to the Close of the day instead:

Static Count As Integer
Static Trigger As Boolean
Static HighClose As Single
If isFirstBar Then
    Count = 0
    Trigger = False
    HighClose = Single.NaN
End If
If CurrentIndex >= 64 Then
    If Price.High > Price.MaxHigh(62, 1) Then
        Count = 0
        Trigger = True
        HighClose = Price.Last
    End If
End If
Count += 1
If Trigger Then
    If Count = 1 Then
        Plot = Price.High - HighClose
    Else
        Plot = Price.MaxHigh(Count) - _
            System.Math.Min(HighClose, Price.MinLow(Count - 1))
    End If
Else
    Plot = Single.NaN
End If

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
thnkbigr
Posted : Tuesday, August 4, 2009 4:40:59 PM
Platinum Customer Platinum Customer

Joined: 3/31/2006
Posts: 3,207

You have no idea if it is correct or not actually since you have no idea which came first, the High or the Low of the Bar.

You are absolutely correct and I was aware of that but I just didn't want to make things too complicated for you to write. I guess you read my mind thanks.

Just note on the 2nd formula above on the day of the 63 day high it's comparing today’s close vs yesterdays high not the high of that day, that's why you have negative numbers on the days that price made a 63 day high and the close is higher than the high of day before.

I don't think that should make a difference for me I just wanted you to be aware of it.

Thanks

Bruce_L
Posted : Tuesday, August 4, 2009 4:48:39 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
QUOTE (thnkbigr)
Just note on the 2nd formula above on the day of the 63 day high it's comparing today’s close vs yesterdays high not the high of that day, that's why you have negative numbers on the days that price made a 63 day high and the close is higher than the high of day before.

I don't think that should make a difference for me I just wanted you to be aware of it.

You're right:

        Plot = Price.High(Count) - HighClose

Should either be:

        Plot = Price.MaxHigh(Count) - HighClose

Or:

        Plot = Price.High - HighClose

Corrected above.

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