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

current bar % above or below day's opening price Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
nandaulgolog
Posted : Thursday, October 21, 2010 6:19:25 AM
Registered User
Joined: 5/16/2010
Posts: 33

hello,

I think the following code does show "current bar high % above or below day's opening price". As an indicator, it seems to plot correctly but when I use it as a sort column or data column, it does not show the last value I see on the indicator graph. can you help fix it? thanks...



'|******************************************************************
'|*** 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
For i As Integer = Start To Price.Bar.Count - 1
 plot = ((price.high() / open) - 1) * 100
Next

nandaulgolog
Posted : Thursday, October 21, 2010 10:38:52 AM
Registered User
Joined: 5/16/2010
Posts: 33
p.s. something else wrong with it is that it is too slow. help ... thanks
nandaulgolog
Posted : Friday, October 22, 2010 3:15:32 AM
Registered User
Joined: 5/16/2010
Posts: 33
I apologize for duplicating this topic on a wrong assumption....

the following code works as an indicator and graphs the percent difference from open in all intraday timeframes.

But when I use it as a data/sort column, it lists values that does not seem to have anything to do with the values it is graphing. 

There is one exception: If the column is unlinked and bar interval is set to "daily", the sort values are very close to the graphed values. 

I'd like to use it intraday while on a 5 or 15 minute time frame. (I do not know if it will nevertheless put out accurate values intraday while it is set to daily... Not tested... I assume it will not...) 

I just cannot figure out how it can put out different values in a condition column while at the same time it is graphing proper values.... 

'|******************************************************************
'|*** 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 in terms of speed)

P.S. 2: I am trying to do these codes by cutting and pasting stuff I see in the forum (often without  understanding what I am doing) so usually  there are some dumb or unneeded lines in the codes I post...

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.