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
|
Registered User Joined: 5/16/2010 Posts: 33
|
p.s. something else wrong with it is that it is too slow. help ... thanks
|
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...
|