Thanks.
By the way, I tried eliminating the #Cumulative statement. Now, however, my watchlist columns (based on rules developed from the indicators) no longer display any colors.
I had to add the #Cumulative statement back in to fix this
|
|
The following indicator attempts to determine just a single final number from any price chart (rather than a full bar-length curve).
It just tells me where the 200day moving average is right now on today's bar (as a percentage of the high and low for the past year).
QUESTION: Is the speed of this routine improved by putting the formula inside the "islastbar" statement the way I have done? As I understand it, this indicator is called once for every bar in the chart. (So I figured the "islastbar" if-statement would cause the formula to be calculated only once rather than for every bar in the chart.)
(My layout has several similar realcode indicators in it, and although it works, it's rather slow. When I added the if statement to each indicator, I didn't seem to get any noticeable improvement.)
Dim hi1yr As Single, lo1yr As Single
'# Cumulative
'# MA200 = chart.MovingAverage
If islastbar Then
hi1yr = MA200.MaxHigh(300)
lo1yr = MA200.MinLow(300)
plot = (MA200.value - lo1yr) / (hi1yr - lo1yr)
End If
|
|
Bruce, this works like a charm! Thanks
|
|
Hi, I'm trying to screen stocks based on their highs and lows during different time frames. I have created two indicators, one in a day-chart and one in a 15 min chart. Each chart has its own copy of the following indicator:
Dim hi As Single, lo As Single
hi = Price.MaxHigh(Price.count - 1)
lo = Price.MinLow(Price.count - 1)
plot = (price.Close - lo) / (hi - lo)
I have then dragged each indicator to the watchlist to create sortable columns. THE PROBLEM: the numbers in the indicators don't agree with the numbers in the coumns. (Example: for stock LUV, the indicators read 0.36 and 0.20 respectively, while the column numbers say 0.46 and 0.90). Doing my own analysis, it looks like the indicator numbers are correct, the 0.36 and 0.20.
I can't figure out how to include the layout or a screenshot in this submittal.
|