indicator for microchannel

offshore

Member
Hey the forum has been great so far, a lot of cool indicators.... I was searching for an intraday 5 minute bar numbering indicator but couldnt seem to find one...does it exist?
 
I have 2 studies that are basically the same but the variables within the studies are changed. Essentially the first study is painting every bar orange that is greater than 1x the average range of the last 10 bars, while the other is painting bars yellow that are greater than 1.5x the average range of the last 10 bars. I cant run them together because any bar qualifying as 1.5x will just be painted orange by default. Im wondering if I can combine them to have both orange and yellow paint bars that meet the criteria on my chart as well as bars over 2.0x average of last 10 bars to be painted as well. Sleepyz helped me greatly on the initial code.

plot Data = close;def Bull =
close > open and
open - low > high - open;
def Bear =
close < open and
high - open > open - low
;
#assignPriceColor(
# if Bull then Color.dark_green
# else if Bear then Color.dark_red
# else Color.Current
#);

input factor = 1;#Hint factor: limited to 1.49
input length = 10;
def cond = (high - low) > Average((high - low), length) * min(factor, 1.49);

input usepricecolor = yes;
AssignPriceColor(if !usepricecolor
then Color.CURRENT else
if cond then Color.orange
else if Bull then Color.DARK_GREEN
else if Bear then Color.DARK_RED
else Color.CURRENT);

input test = yes;
AddChartBubble(test, low * .9994, "C " + cond + "\nHL " + (high - low) + "\nA " + (Average((high - low), length) * Min(factor, 1)) + "\nF " + Min(factor, 1), if cond then Color.orange
else Color.GRAY, no);
 
I have 2 studies that are basically the same but the variables within the studies are changed. Essentially the first study is painting every bar orange that is greater than 1x the average range of the last 10 bars, while the other is painting bars yellow that are greater than 1.5x the average range of the last 10 bars. I cant run them together because any bar qualifying as 1.5x will just be painted orange by default. Im wondering if I can combine them to have both orange and yellow paint bars that meet the criteria on my chart as well as bars over 2.0x average of last 10 bars to be painted as well. Sleepyz helped me greatly on the initial code.

plot Data = close;def Bull =
close > open and
open - low > high - open;
def Bear =
close < open and
high - open > open - low
;
#assignPriceColor(
# if Bull then Color.dark_green
# else if Bear then Color.dark_red
# else Color.Current
#);

input factor = 1;#Hint factor: limited to 1.49
input length = 10;
def cond = (high - low) > Average((high - low), length) * min(factor, 1.49);

input usepricecolor = yes;
AssignPriceColor(if !usepricecolor
then Color.CURRENT else
if cond then Color.orange
else if Bull then Color.DARK_GREEN
else if Bear then Color.DARK_RED
else Color.CURRENT);

input test = yes;
AddChartBubble(test, low * .9994, "C " + cond + "\nHL " + (high - low) + "\nA " + (Average((high - low), length) * Min(factor, 1)) + "\nF " + Min(factor, 1), if cond then Color.orange
else Color.GRAY, no);

This will paint each candle in this hierarchy:
cond3, if true, first, even if cond 2 and cond1 were true;
cond2 next, if not cond3 being true;
and cond1 if not cond3 or cond2 being true

I made cond3 be white, cond2 be yellow and cond1 be magenta so that you could better see them when testing. Change them to whatever you want thereafter.

Screenshot-2022-12-14-055059.png
Ruby:
def Bull =
close > open and
open - low > high - open;
def Bear =
close < open and
high - open > open - low
;
#assignPriceColor(
# if Bull then Color.dark_green
# else if Bear then Color.dark_red
# else Color.Current
#);

input factor = 1;#Hint factor: limited to 1.49
input length = 10;
def cond1 = (high - low) > Average((high - low), length) * 1;
def cond2 = (high - low) > Average((high - low), length) * 1.5;
def cond3 = (high - low) > Average((high - low), length) * 2;

input usepricecolor = yes;
AssignPriceColor(if !usepricecolor
then Color.CURRENT else
if cond3 then Color.WHITE
else if cond2 then Color.YELLOW
else if cond1 then Color.MAGENTA
else if Bull then Color.DARK_GREEN
else if Bear then Color.DARK_RED
else Color.CURRENT);

input test = no;
AddChartBubble(test, low * .9994, "C 3: " + cond3 + "\n 2: " + cond2 + "\n 1: " + cond1 + "\nHL " + (high - low) + "\nA " + (Average((high - low), length) * Min(factor, 1)) + "\nF " + Min(factor, 1), if cond3 then color.white else if cond2 then color.yellow else if cond1 then color.magenta else Color.GRAY, no);
 
Try these, the top one follows what you said. If that's not what you actually meant, try the bottom one.

Ruby:
def Bull =
    Close > Open and
    Open - Low > Close - Open;
def Bear =
    Close < Open and
    High - Open > Open - Close
;
assignPriceColor(
    if Bull then Color.Dark_Green
    else if Bear then Color.Plum
    else Color.Current
);

Ruby:
def Bull =
    Close > Open and
    Open - Low > High - Open;
def Bear =
    Close < Open and
    High - Open > Open - Low
;
assignPriceColor(
    if Bull then Color.Dark_Green
    else if Bear then Color.Plum
    else Color.Current
);
Hey @Joshua Im looking to add a wrinkle to this code you provided me a while back. Basically I want to paint every bull bar closing below its midpoint as a bear bar and every bear bar closing above its midpoint as a bull bar. Thanks so much
 
Is there an easy way to add the indicator into this study I already use with bar painting?

plot Data = close;def Bull =
close > open and
open - low > high - open;
def Bear =
close < open and
high - open > open - low
;
#assignPriceColor(
# if Bull then Color.dark_green
# else if Bear then Color.dark_red
# else Color.Current
#);

input factor = 1;#Hint factor: limited to 1.49
input length = 10;
def cond1 = (high - low) > Average((high - low), length) * 1.2;
def cond2 = (high - low) > Average((high - low), length) * 1.7;
def cond3 = (high - low) > Average((high - low), length) * 2;

input usepricecolor = yes;
AssignPriceColor(if !usepricecolor
then Color.CURRENT else
if cond3 then Color.violet
else if cond2 then Color.orange
else if cond1 then Color.orange
else if Bull then Color.DARK_green
else if Bear then Color.DARK_red
else Color.CURRENT);

input test = no;
AddChartBubble(test, low * .9994, "C 3: " + cond3 + "\n 2: " + cond2 + "\n 1: " + cond1 + "\nHL " + (high - low) + "\nA " + (Average((high - low), length) * Min(factor, 1)) + "\nF " + Min(factor, 1), if cond3 then color.white else if cond2 then color.yellow else if cond1 then color.magenta else Color.GRAY, no);



And then add this to it

plot Data = close;def Bull =
Close > Open and
close < HL2;
def Bear =
Close < Open and
close > HL2
;
assignPriceColor(
if Bull then Color.light_red
else if Bear then Color.light_green
else Color.Current
);

Thanks
 
Its a bit late where I am at, and I don't quite understand what you're asking, there is too much going on. I am not sure what to replace, combine, etc. From the look of it, the solution should be fairly easy, but only if I understand the question. It might be best to just describe the situation clearly in plain English and let me write it from scratch.
 
Hey sorry about that. Basically both studies have bar painting in them so I cant run them at the same time. I wanted to incorporate the 2nd study I posted into the first study so all the bars I want to get painted are painted. The first study paints bars that 1.2x 1.7x and 2x the AVG of the last 10 bars as well as bear and bull bars with tails bigger than their bodies. The 2nd study is the one you helped me in this thread which paints bear bars closing above their midpoints and bull bars that close below midpoints.

So essentially having one study that paints all the bars that fir the criteria i mentioned would be ideal. Thanks so much
 
I was also messing around with this condition to add to the existing list of conditions but it doesnt seem to work

def cond1 = (high - low) < Average((high - low), length) * 0.1-.8;
 

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

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
455 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