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 |

Volume Surge Gradient Painting Topic Rating:
Previous Topic · Next Topic Watch this topic · Print this topic ·
Royal
Posted : Thursday, October 29, 2009 12:31:19 PM
Platinum Customer Platinum Customer

Joined: 10/7/2004
Posts: 127

I would like to paint price candles on a gradient scale using the volume surge value.   I do this manually now and it seems to clog down the system when i create all the individual rules. 

First, price candles are painted white and stay white while VS <1.  
if VS >1 then candles are yellow
if VS >2 then candles are orange
if VS >3 then candles are red
if VS>4 then candles are magenta

I would like to use more shades of the colors thereby being able to identify VS 2.1 vs VS 2.8 (the latter would be a very dark orange, closer to red).  

Im sure there is a way to do this, however I havent had any luck with the RealCode after reading the manual.  

Can someone point me in the right direction?

StockGuy
Posted : Thursday, October 29, 2009 12:48:32 PM

Administration

Joined: 9/30/2004
Posts: 9,187

Click on Volume Surge to edit, then click the Colors tab. Place a check by "Paint with RealCode" then click the Edit link.

Click Indicators/Rules button and select Volume Surge then enter the following code:

'# VS = indicator.VolumeSurge (added when you add VS to the code)

If vs.value > 4 Then
 plotcolor = color.Magenta
Else If vs.value > 3 Then
 plotcolor = color.red
Else If vs.value > 2 Then
 plotcolor = color.Orange
Else If vs.value > 1 Then
 plotcolor = color.Yellow
Else
 plotcolor = color.white
End If

Bruce_L
Posted : Thursday, October 29, 2009 1:21:07 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
Royal,
If you Drag and Drop Volume Surge into the Code tab of the RealCode Editor, it should create something similar to the first line of the following RealCode Paint Brush:

'# VS = indicator.VolumeSurge
Dim Red As Single = 637.5 - 127.5 * VS.Value
If Red < 127.5 Then Red = 127.5
If Red > 255 Then Red = 255
Dim Green As Single = 382.5 - 127.5 * VS.Value
If Green < 0 Then Green = 0
If Green > 255 Then Green = 255
Dim Blue As Single = 255 - 255 * VS.Value
If Blue < 0 Then Blue = 0
If Blue > 255 Then Blue = 255
PlotColor = Color.FromArgb(255, Red, Green, Blue)

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Royal
Posted : Thursday, October 29, 2009 2:37:21 PM
Platinum Customer Platinum Customer

Joined: 10/7/2004
Posts: 127
Bruce, this is awesome! thank you for the help.
Bruce_L
Posted : Thursday, October 29, 2009 2:39:26 PM


Worden Trainer

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

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Royal
Posted : Friday, October 30, 2009 3:53:43 PM
Platinum Customer Platinum Customer

Joined: 10/7/2004
Posts: 127
Bruce,

I realized after messing around with the paint scheme that it works extremely well for stocks and etf's for the most point, however it doesnt do a very good job with the broad market indicies.  For instance if you look at SPY the index never hits a 2x volume surge.  In order to correct the scaling i was thinking that I could compare volume surge on a percentage basis of its 50 or 100 day high.  Then the colors would be scaled from 

white (under 25%) 

yellow (25-50%) 

orange (50-75%) 

red (75-100%) 

Does this make sense, if so, can you help me code this efficiently?

AJ

Bruce_L
Posted : Friday, October 30, 2009 4:24:26 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
Royal,
If you add a Stochastics of Indicator (with a Period of 50 or 100) to Volume Surge (or Volume for that matter) as a Child Indicator, you can Drag and Drop it into the Code tab of the RealCode Editor to create something similar to the first line of the following RealCode Paint Brush:

'# Stoc = indicator.Stochastics
Dim Red As Single = 637.5 - 5.1 * Stoc.Value
If Red < 127.5 Then Red = 127.5
If Red > 255 Then Red = 255
Dim Green As Single = 382.5 - 5.1 * Stoc.Value
If Green < 0 Then Green = 0
If Green > 255 Then Green = 255
Dim Blue As Single = 255 - 10.2 * Stoc.Value
If Blue < 0 Then Blue = 0
If Blue > 255 Then Blue = 255
PlotColor = Color.FromArgb(255, Red, Green, Blue)

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