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 |

color volume based on volume Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
3dbeing
Posted : Friday, August 7, 2009 7:11:33 PM
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
m_badger
Posted : Sunday, August 9, 2009 12:18:02 PM
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
3dbeing
Posted : Sunday, August 9, 2009 8:11:41 PM
Registered User
Joined: 6/24/2009
Posts: 178
well that turns them all green...
StockGuy
Posted : Sunday, August 9, 2009 9:58:05 PM

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
3dbeing
Posted : Monday, August 10, 2009 10:17:39 AM
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...
Bruce_L
Posted : Monday, August 10, 2009 2:59:52 PM


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
3dbeing
Posted : Monday, August 10, 2009 4:37:57 PM
Registered User
Joined: 6/24/2009
Posts: 178
very nice, thanks Bruce!
Bruce_L
Posted : Monday, August 10, 2009 4:46:56 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
3dbeing,
You're welcome. Our pleasure.

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