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

Add Dividend to code Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
Michaelkarasik
Posted : Friday, October 11, 2013 2:00:29 PM
Platinum Customer Platinum Customer

Joined: 10/7/2004
Posts: 80

Bruce,

Please add a condition of Dividend >= to 1.5% to this code. 

Thanks,

Michael

'# SMAperiod = UserInput.Integer = 225
'# AbovePeriod = UserInput.Integer = 250
'# Percent = UserInput.Single = 90
Static Count As Integer
Static Threshold As Single
Static Valid As Integer
If isFirstBar Then
Count = 0
Threshold = AbovePeriod * Percent / 100
Valid = AbovePeriod + SMAperiod - 1
SetIndexInvalid
Else If CurrentIndex >= SMAperiod Then
If Price.Last > Price.AVGC(SMAperiod) Then
Count += 1
End If
If CurrentIndex > Valid Then
If Price.Last(AbovePeriod) > Price.AVGC(SMAperiod, AbovePeriod) Then
Count -= 1
End If
If Count >= Threshold Then
Pass
End If
Else
SetIndexInvalid
End If
Else
SetIndexInvalid
End If
Bruce_L
Posted : Friday, October 11, 2013 2:42:38 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

Please try the following RealCode Condition:

'# SMAperiod = UserInput.Integer = 225
'# AbovePeriod = UserInput.Integer = 250
'# Percent = UserInput.Single = 90
'# DY = indicator.Library.Dividend Yield
Static Count As Integer
Static Threshold As Single
Static Valid As Integer
If isFirstBar Then
	Count = 0
	Threshold = AbovePeriod * Percent / 100
	Valid = AbovePeriod + SMAperiod - 1
	SetIndexInvalid
Else If CurrentIndex >= SMAperiod Then
	If Price.Last > Price.AVGC(SMAperiod) Then
		Count += 1
	End If
	If CurrentIndex > Valid Then
		If Price.Last(AbovePeriod) > Price.AVGC(SMAperiod, AbovePeriod) Then
			Count -= 1
		End If
		If Count >= Threshold AndAlso _
			DY.Value >= 1.5 Then
			Pass
		End If
	Else
		SetIndexInvalid
	End If
Else
	SetIndexInvalid
End If


-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Michaelkarasik
Posted : Friday, October 11, 2013 3:51:20 PM
Platinum Customer Platinum Customer

Joined: 10/7/2004
Posts: 80

Thank you.

Michael

mkirby
Posted : Tuesday, November 26, 2013 10:17:22 AM
Registered User
Joined: 3/11/2005
Posts: 10

Dividend yields are wrong !

 Dividend Yield - This is the latest dividend divided by the share price. It reads in percentage.

Unfortunately - when I look at DRAD I get WAY different numbers

Morningstar says       YIELD is 1.13
TC2000                     YIELD is 4.51
Telechat                    YIELD is 5.22
 
SO .... what gives?  Confidence in low at this time. 
mkirby
Posted : Tuesday, November 26, 2013 10:26:09 AM
Registered User
Joined: 3/11/2005
Posts: 10

Ok  Telechart adjusted today to read Yield for DRAD as 4.51 .... but still ?!?!

Bruce_L
Posted : Tuesday, November 26, 2013 10:27:18 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

Thank you for reporting the issue. I am forwarding the information to our data department for clarification on the calculations.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Bruce_L
Posted : Tuesday, November 26, 2013 1:25:35 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

I checked with our data department and what we are currently reporting is Projected Yield. We will be adding trailing yield early next week.

Dividend Yield - Dividends Per Share over the trailing 12 months / Price
Projected Dividend Yield - (Current Dividend Per Share * Payout Frequency) / Price



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