Volume Bar Painting by Standard Deviation

grapetux

Member
trying to get this to display only if the below is true so it will not paint over other standard deviation colored candles

def x = devincrease > 0 and devincrease <=1;

assignpricecolor(if x then color.orange else (DO NOTHING??)
- if i put color.current it wont allow other signals to paint

basically need the language or equivalent of double.nan ?

If you can't tell, I have a lot to learn. Any help would be greatly appreciated
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Color.Current is the method for that. Explain what you're trying to do in more detail. The issue is likely somewhere else.
Hi thanks
Im looking to have a volume study that does the following
=3 deviations paints candles color 1
=2 deviations paints candles color 2
=1 deviation paints candles color 3

upticks can be the current color
downticks would be colored gray, and would be a candle with falling volume (thats not a colored standard deviation candle)

I need help with the conditions.. the signal from the 1 standard deviation parameter paints over the 2s and 3s

Does this make sense? I'm happy to try and elaborate further
thank you so much for your help :)
 
I'm still not %100 sure what you're asking.

Try this, tell me what's right about it, and what's wrong about it.
You can obviously change the colors to what ever you want.

Code:
input Length = 50;
def sDev = Stdev(Volume,Length);
def sDev2 = sDev * 2;
def sDev3 = sDev * 3;
AssignPriceColor(
    if Volume < Volume[1] then Color.gray
    else if Volume > sDev3 then Color.Green
    else if Volume > sDev2 then Color.Yellow
    else if Volume > sDev then Color.Orange
    else color.current
);
 
thanks for your prompt reply, heres the code ive been working with.


def Deviation_Length = 60;
def Deviate = 2;
def volumestdev = RelativeVolumeStDev(length = Deviation_Length);
def abovedev = volumestdev >= Deviate;

def belowdev = volumestdev <= Deviate;

plot volumereplace = volume;
volumereplace.SetPaintingStrategy(paintingStrategy = PaintingStrategy.HISTOGRAM);
def increase = volume > volume[1];
def devincrease = increase and abovedev;
def decrease = volume < volume[1];
def devdecrease = decrease and abovedev;
volumereplace.DefineColor("Increase", Color.DARK_GREEN);
volumereplace.DefineColor("DevIncrease", Color.GREEN);
volumereplace.DefineColor("Decrease", Color.DARK_RED);
volumereplace.DefineColor("DevDecrease", Color.LIGHT_RED);
volumereplace.AssignValueColor(
if devincrease then volumereplace.Color("DevIncrease")
else
if increase then volumereplace.Color("Increase")
else
if devdecrease then volumereplace.Color("DevDecrease")
else
volumereplace.Color("Decrease"));


I cant tell if what you sent is giving me the same results..
Is there a way, using the language and definitions in the above code to achieve the same thing?

Again just looking for the volume deviations to plot their own colors
Im very new to coding so this is quite challenging, i appreciate the help
 
This should actually be fairly simple, but I don't see any consideration for 1 standard deviation, or 3 standard deviations, in this code, compared to your first reply. Let me see if I am understanding this correctly:

You want three different colors depending on whether its above 3, 2, or 1 standard deviations. However, you want each of these to also be a different shade depending on whether volume increased or decreased relative to the prior bar. Is this correct?

Just for example, both green bars are above 2 standard deviations in this picture, but the darker green is a decrease:

zUq3AvX.png
 
This should actually be fairly simple, but I don't see any consideration for 1 standard deviation, or 3 standard deviations, in this code, compared to your first reply. Let me see if I am understanding this correctly:

You want three different colors depending on whether its above 3, 2, or 1 standard deviations. However, you want each of these to also be a different shade depending on whether volume increased or decreased relative to the prior bar. Is this correct?

Just for example, both green bars are above 2 standard deviations in this picture, but the darker green is a decrease:

zUq3AvX.png
Here's what I've put together so far
For the Dev increase/decrease I keep those colors the same for simplicity.

I copy and pasted the plot section so I can put all 3 of the different deviation levels in the same indicator
Thats where I reference the different deviation levels ( deviate 1,2 etc. )
I really like how its shaping up !





def Deviation_Length = 60;
def Deviate = 1;
def volumestdev = RelativeVolumeStDev(length = Deviation_Length);
def abovedev = volumestdev >= Deviate;

def belowdev = volumestdev <= Deviate;

##

plot volumereplace = volume;
volumereplace.SetPaintingStrategy(paintingStrategy = PaintingStrategy.HISTOGRAM);
def increase = volume > volume[1];
def devincrease = increase and abovedev;
def decrease = volume < volume[1];
def devdecrease = decrease and abovedev;
volumereplace.DefineColor("Increase", Color.DARK_GREEN);
volumereplace.DefineColor("DevIncrease", Color.GREEN);
volumereplace.DefineColor("Decrease", Color.DARK_RED);
volumereplace.DefineColor("DevDecrease", Color.LIGHT_RED);
volumereplace.AssignValueColor(
if devincrease then volumereplace.Color("DevIncrease")
else
if increase then volumereplace.Color("Increase")
else
if devdecrease then volumereplace.Color("DevDecrease")
else
volumereplace.Color("Decrease"));


AssignPriceColor(if volumestdev >= 0 and volumestdev >1 then Color.orange else Color.CURRENT);


##1
def Deviate1 = 2;
plot volumereplace1 = volume;
volumereplace.SetPaintingStrategy(paintingStrategy = PaintingStrategy.HISTOGRAM);
def increase1 = volume > volume[1];
def devincrease1 = increase and abovedev;
def decrease1 = volume < volume[1];
def devdecrease1= decrease and abovedev;
volumereplace1.DefineColor("Increase", Color.DARK_GREEN);
volumereplace1.DefineColor("DevIncrease", Color.GREEN);
volumereplace1.DefineColor("Decrease", Color.DARK_RED);
volumereplace1.DefineColor("DevDecrease", Color.LIGHT_RED);
volumereplace1.AssignValueColor(
if devincrease1 then volumereplace1.Color("DevIncrease")
else
if increase1 then volumereplace1.Color("Increase")
else
if devdecrease1 then volumereplace1.Color("DevDecrease")
else
volumereplace1.Color("Decrease"));

AssignPriceColor(if volumestdev >= 2 then Color.magenta else Color.CURRENT);

##2
def Deviate2 = 3;
plot volumereplace2 = volume;
volumereplace.SetPaintingStrategy(paintingStrategy = PaintingStrategy.HISTOGRAM);
def increase2 = volume > volume[1];
def devincrease2 = increase and abovedev;
def decrease2 = volume < volume[1];
def devdecrease2= decrease and abovedev;
volumereplace2.DefineColor("Increase", Color.DARK_GREEN);
volumereplace2.DefineColor("DevIncrease", Color.GREEN);
volumereplace2.DefineColor("Decrease", Color.DARK_RED);
volumereplace2.DefineColor("DevDecrease", Color.LIGHT_RED);
volumereplace2.AssignValueColor(
if devincrease2 then volumereplace2.Color("DevIncrease")
else
if increase2 then volumereplace2.Color("Increase")
else
if devdecrease2 then volumereplace2.Color("DevDecrease")
else
volumereplace2.Color("Decrease"));


AssignPriceColor(if volumestdev >= 3 then Color.white else Color.CURRENT);
 
Here's what I've put together so far
For the Dev increase/decrease I keep those colors the same for simplicity.

I copy and pasted the plot section so I can put all 3 of the different deviation levels in the same indicator
Thats where I reference the different deviation levels ( deviate 1,2 etc. )
I really like how its shaping up !





def Deviation_Length = 60;
def Deviate = 1;
def volumestdev = RelativeVolumeStDev(length = Deviation_Length);
def abovedev = volumestdev >= Deviate;

def belowdev = volumestdev <= Deviate;

##

plot volumereplace = volume;
volumereplace.SetPaintingStrategy(paintingStrategy = PaintingStrategy.HISTOGRAM);
def increase = volume > volume[1];
def devincrease = increase and abovedev;
def decrease = volume < volume[1];
def devdecrease = decrease and abovedev;
volumereplace.DefineColor("Increase", Color.DARK_GREEN);
volumereplace.DefineColor("DevIncrease", Color.GREEN);
volumereplace.DefineColor("Decrease", Color.DARK_RED);
volumereplace.DefineColor("DevDecrease", Color.LIGHT_RED);
volumereplace.AssignValueColor(
if devincrease then volumereplace.Color("DevIncrease")
else
if increase then volumereplace.Color("Increase")
else
if devdecrease then volumereplace.Color("DevDecrease")
else
volumereplace.Color("Decrease"));


AssignPriceColor(if volumestdev >= 0 and volumestdev >1 then Color.orange else Color.CURRENT);


##1
def Deviate1 = 2;
plot volumereplace1 = volume;
volumereplace.SetPaintingStrategy(paintingStrategy = PaintingStrategy.HISTOGRAM);
def increase1 = volume > volume[1];
def devincrease1 = increase and abovedev;
def decrease1 = volume < volume[1];
def devdecrease1= decrease and abovedev;
volumereplace1.DefineColor("Increase", Color.DARK_GREEN);
volumereplace1.DefineColor("DevIncrease", Color.GREEN);
volumereplace1.DefineColor("Decrease", Color.DARK_RED);
volumereplace1.DefineColor("DevDecrease", Color.LIGHT_RED);
volumereplace1.AssignValueColor(
if devincrease1 then volumereplace1.Color("DevIncrease")
else
if increase1 then volumereplace1.Color("Increase")
else
if devdecrease1 then volumereplace1.Color("DevDecrease")
else
volumereplace1.Color("Decrease"));

AssignPriceColor(if volumestdev >= 2 then Color.magenta else Color.CURRENT);

##2
def Deviate2 = 3;
plot volumereplace2 = volume;
volumereplace.SetPaintingStrategy(paintingStrategy = PaintingStrategy.HISTOGRAM);
def increase2 = volume > volume[1];
def devincrease2 = increase and abovedev;
def decrease2 = volume < volume[1];
def devdecrease2= decrease and abovedev;
volumereplace2.DefineColor("Increase", Color.DARK_GREEN);
volumereplace2.DefineColor("DevIncrease", Color.GREEN);
volumereplace2.DefineColor("Decrease", Color.DARK_RED);
volumereplace2.DefineColor("DevDecrease", Color.LIGHT_RED);
volumereplace2.AssignValueColor(
if devincrease2 then volumereplace2.Color("DevIncrease")
else
if increase2 then volumereplace2.Color("Increase")
else
if devdecrease2 then volumereplace2.Color("DevDecrease")
else
volumereplace2.Color("Decrease"));


AssignPriceColor(if volumestdev >= 3 then Color.white else Color.CURRENT);


heres the final code i added to get downticks below 1 SD to print gray

assignpricecolor(if decrease and volumestdev <1 then color.gray else color.current);
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
393 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top