Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 6/24/2009 Posts: 178
|
I have searched and searched cuz I didn't want to ask another dumb question, but I have to.
I want to color the volume based on the days previous volume
code as I would expect it..but paints all volume red
For i As Integer = 1 To price.Line.count - 1
If Volume.Last(i) > Volume.Last(i - 1) Then
MyBase.addtooutput(price.line.datevalue(i), color.lime)
Else
MyBase.addtooutput(price.line.datevalue(i),color.red)
End If
Next
|
|
Registered User Joined: 9/13/2008 Posts: 99
|
3dbeing,
Did you want this part
For i As Integer = 1 To price.Line.count - 1 If Volume.Last(i) > Volume.Last(i - 1) Then
to be this instead:
For i As Integer = 0 To price.Line.count - 1 If Volume.Last(i) > Volume.Last(i + 1) Then
_mad
|
|
Registered User Joined: 6/24/2009 Posts: 178
|
well that turns them all green...
|
|
Administration
Joined: 9/30/2004 Posts: 9,187
|
Why not just use the following in a RealCode paintbrush?
If Volume.Value > Volume.Value(1) then
plotcolor = color.lime
Else
plotcolor = color.red
End If
|
|
Registered User Joined: 6/24/2009 Posts: 178
|
QUOTE (StockGuy) Why not just use the following in a RealCode paintbrush?
I was just building off of the code that is already in there
QUOTE (StockGuy) If Volume.Value > Volume.Value(1) then
plotcolor = color.lime
Else
plotcolor = color.red
End If
If I put this code in it defaults to the base color...
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
3dbeing,
The Paint Brush for the standard Volume Bars in StockFinder uses manual looping in the Class tab instead of the built in looping in the Code tab. I think you should get the desired results if you replace everything after the Inherits line in the Class tab of the RealCode Paint Brush with the following:
Sub New
AutoLoop = False
End Sub
Public Overrides Sub CallUserCode()
For i As Integer = 1 To Volume.Line.Count - 1
If Volume.Line.Value(i) > Volume.Line.Value(i - 1) Then
AddToOutput(Volume.Line.DateValue(i), Color.Lime)
Else
AddToOutput(Volume.Line.DateValue(i), Color.Red)
End If
Next
End Sub
End Class
RealCode Paint Brushes also have a feature where you can reference the Value of the Indicator being Painted instead referencing Price, Volume or a Drag and Drop Indicator. Doing so would involve using Line instead of Volume in the RealCode to Indicator that you were using the Values of whatever is being Painted:
Sub New
AutoLoop = False
End Sub
Public Overrides Sub CallUserCode()
For i As Integer = 1 To Line.Line.Count - 1
If Line.Line.Value(i) > Line.Line.Value(i - 1) Then
AddToOutput(Line.Line.DateValue(i), Color.Lime)
Else
AddToOutput(Line.Line.DateValue(i), Color.Red)
End If
Next
End Sub
End Class
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 6/24/2009 Posts: 178
|
very nice, thanks Bruce!
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
3dbeing,
You're welcome. Our pleasure.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Guest-1 |