Registered User Joined: 1/2/2008 Posts: 41
|
Dear Bruce,
I asked this question last Sunday, but I don;t see it posted, that is why I am asking againg
Could you help me with this real code? I would like to have a chart for StockFinder 5 that displays around the price Indicator = MovAverage (price, period=20) +parameter* C_last*Square_root( Std_Dev ( Ln(Ci/Ci+1 ), period=20)) where Std_Dev is the standard deviation, The parameter take the values p= 4,3,-3,-4. I was able to implement it in TC2000, I am including the code I wrote, but I badly need it for StockFinder 5 that is where I have the indicators I used. I have tried to do it in StockFinder 5 but have failed. Thank in advance for your help as always. In TC2000:
AVGC20 +4*C*SQR(( ( Log(C1/C2)^2 + Log(C2/C3)^2 + Log(C3/C4)^2 + Log(C4/C5)^2 + Log(C5/C6)^2 + Log(C6/C7)^2 + Log(C7/C8)^2 + Log(C8/C9)^2 + Log(C9/C10)^2 + Log(C10/C11)^2 + Log(C11/C12)^2 + Log(C12/C13)^2 + Log(C13/C14)^2 + Log(C14/C15)^2 + Log(C15/C16)^2 + Log(C16/C17)^2 + Log(C17/C18)^2 + Log(C18/C19)^2 + Log(C19/C20)^2 + Log(C20/C21)^2 )- ( Log(C1/C2) + Log(C2/C3) + Log(C3/C4) + Log(C4/C5)+ Log(C5/C6) + Log(C6/C7) + Log(C7/C8) + Log(C8/C9) + Log(C9/C10) + Log(C10/C11) + Log(C11/C12) + Log(C12/C13) + Log(C13/C14) + Log(C14/C15) + Log(C15/C16) + Log(C16/C17) + Log(C17/C18) + Log(C18/C19) + Log(C19/C20) + Log(C20/C21) )^2/20)/19)
Roberto
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Please try the following RealCode Indicator:
RealCode for Real People: Indicators
'|******************************************************************
'|*** StockFinder RealCode Indicator - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Indicator:RealCode Band
'|******************************************************************
'# Period = UserInput.Integer = 20
'# Parameter = UserInput.Single = 4
Static Sum(2) As Single
If isFirstBar Then
Sum(0) = 0
Sum(1) = 0
Sum(2) = 0
Else If CurrentIndex > Period + 1 Then
Sum(0) += Price.Last - Price.Last(Period)
Sum(1) += Math.Log(Price.Last(1) / Price.Last(2)) - _
Math.Log(Price.Last(Period + 1) / Price.Last(Period + 2))
Sum(2) += Math.Log(Price.Last(1) / Price.Last(2)) ^ 2 - _
Math.Log(Price.Last(Period + 1) / Price.Last(Period + 2)) ^ 2
Else If CurrentIndex > 1 Then
Sum(0) += Price.Last
Sum(1) += Math.Log(Price.Last(1) / Price.Last(2))
Sum(2) += Math.Log(Price.Last(1) / Price.Last(2)) ^ 2
End If
If CurrentIndex > Period Then
Plot = Sum(0) / Period + Parameter * Price.Last * _
((Sum(2) - (Sum(1) ^ 2) / Period) / (Period - 1)) ^ .5
Else
Plot = Single.NaN
End If
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
Registered User Joined: 1/2/2008 Posts: 41
|
Dear Bruce,
Thank you. It is just excellent.
Regards
Roberto
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You're welcome.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|