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 |

% up or down value from opening price of the day Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
nandaulgolog
Posted : Thursday, October 21, 2010 4:57:03 PM
Registered User
Joined: 5/16/2010
Posts: 33
hello,
It is not my intention to be repetitive or spam. I am posting this again because I thinkt that maybe you only look at 0-response posts. (Since when I post an additional message it looks like it has been responded to, I am posting this again.)

I am trying to do these codes by cutting and pasting stuff I see in the forum (without always understanding what I am doing) so I am sure there are always some dumb things in them... in any case, pruned the for...next loop in the earlier post... appearantly not needed... 

But the main problem remains and I have no idea why:  it works as an indicator, graphing the correct values but gives totally different values when used in a sort or data column....

'|******************************************************************
'|*** StockFinder RealCode Indicator - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Indicator:% above or below opening today
'|*** Example: plot = price.close - price.close(1)
'|******************************************************************

Dim Start As Integer = Price.Bar.Count - 1
Dim Open As Single = Price.Bar.OpenValue(Start)

While Price.Bar.DateValue(Start).DayOfYear = Price.Bar.DateValue(Start - 1).DayOfYear
 Start -= 1
 Open = Price.Bar.OpenValue(Start)
End While
plot = ((price.high() / open) - 1) * 100


 (P.S.: Also, the original was too slow in real time and often failed to catch up with the charts, I don't yet know how this one acts speedwise...)

Bruce_L
Posted : Monday, October 25, 2010 10:49:23 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
I suspect the original upon which you based your RealCode was designed to Plot only the current Day using the Class tab with AutoLoop = False.

If you are going to Plot values for more than just the current Day, you might want to try something similar to the following in the Code tab.

'|******************************************************************
'|*** StockFinder RealCode Indicator - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Indicator:% above or below opening today
'|******************************************************************
Static DayOpen As Single
If isFirstBar Then
    DayOpen = Single.NaN
Else If Price.DateValue.DayOfYear <> Price.DateValue(1).DayOfYear Then
    DayOpen = Price.Open
End If
Plot = 100 * (Price.Last / DayOpen - 1)

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