Price Action Indicator

woulf1004

Active member
Hi team,

Is there anyway possible to code a script that plots a line based on each closing of the candle or tick for any time frame that is being used?
Please see the attached for your reference.


Thanks in advance.
 
Based on how I am reading the question, it would just be:

Plot X = Close;

But I suspect, based on the image, that its more complicated than that.

Could you provide more detail?
 
Hi Joshua,

Yes, I need and indicator that plots a line which is followed by each closing candle just like the white color line in the image (left side) attached. The chart on the right side is the regular candle chart so we can compare it, and the way I am currently getting this line is by adjusting the chart settings which is forcing me choose between a regular candle or any line plotting. I would like to have both, the candles and the lines plotted based on each candle that closes and there fore I would like to have a separate indicator that plots the line for me.

 
Last edited:
Running it on tick itself:
Code:
Plot X = Close;
X.setdefaultColor(color.white);
Plot Y = Close;
Y.setPaintingStrategy(paintingStrategy.SQUARES);
Y.setdefaultColor(color.white);

Running it separate:
Code:
Declare Lower;
Plot X = Close("$TICK");
X.setdefaultColor(color.white);
Plot Y = Close("$TICK");
Y.setPaintingStrategy(paintingStrategy.SQUARES);
Y.setdefaultColor(color.white);

You can also add in something like...
Code:
plot T = 1000;
plot Z = 0;
plot B = -1000;
 
The First one works and it's what I was looking for. You are all geniuses! Thank you so much.
Oh and I have added your code at the end and this is what I can share for anyone who's interested in using the $TICK chart which is very useful. Happy trading.

input ShowDistArrows = yes;
input ShowCloud = no;
input UpThreshold = 1000;
input UpThreshold2 = 700;
input DownThreshold = -1000;
input DownThreshold2 = -700;
input DistArrowLevel = 1500;
input ShowHiLo = yes;

def Above = if close > UpThreshold then 1 else 0;
def Below = if close < DownThreshold then 1 else 0;

plot pline;
plot pline2;
plot nline;
plot nline2;
pline = UpThreshold;
pline2 = UpThreshold2;
nline = DownThreshold;
nline2 = DownThreshold2;

pline.SetStyle(Curve.LONG_DASH);
pline.SetDefaultColor(Color.RED);
pline2.SetStyle(Curve.LONG_DASH);
pline2.SetDefaultColor(Color.RED);
nline.SetStyle(Curve.LONG_DASH);
nline.SetDefaultColor(Color.GREEN);
nline2.SetStyle(Curve.LONG_DASH);
nline2.SetDefaultColor(Color.GREEN);

Def cloudhigh = if ShowCloud then pline else Double.NaN;
Def cloudlow = if ShowCloud then nline else Double.NaN;

AddCloud (cloudhigh, cloudlow, Color.DARK_GRAY, Color.DARK_GRAY);
AddLabel(ShowHiLo,“HI ”+AsText(high(“$TICK”, ”Day”, ”LAST”)), Color.ORANGE);
AddLabel(ShowHiLo,“LO ”+AsText(low(“$TICK”, ”Day”, ”LAST”)), Color.ORANGE);
AddLabel(close >= 0 and close <= UpThreshold,close+ ” ”,Color.GREEN);
AddLabel(close < 0 and close >= DownThreshold,close+ ” ”,Color.RED);
AddLabel(close > UpThreshold,”[+1k] = “+ close, Color.GREEN);
AddLabel(close < DownThreshold,”[-1k] = “+close, Color.RED);

#Distribution Function
def Less = If((close < 0), 1, 0); def Greater = If((close > 0), 1, 0);
def closeByPeriod = close(period = “DAY”)[-1];
def newDay = if !IsNaN(closeByPeriod) then 0 else 1;
plot DistributionUp;
plot DistributionDown;

if !IsNaN(close(period = “DAY”)[-1])
then {

DistributionUp = Double.NaN;
DistributionDown = Double.NaN;

} else {

DistributionUp = if newDay and ShowDistArrows and Greater then +DistArrowLevel else Double.NaN;
DistributionDown = if newDay and ShowDistArrows and Less then -DistArrowLevel else Double.NaN;
}

DistributionUp.SetStyle(Curve.POINTS);
DistributionUp.SetPaintingStrategy(PaintingStrategy.LINE_VS_TRIANGLES);
DistributionUp.SetDefaultColor(Color.GREEN);
DistributionUp.SetLineWeight(3);
DistributionDown.SetStyle(Curve.POINTS);
DistributionDown.SetPaintingStrategy(PaintingStrategy.LINE_VS_TRIANGLES);
DistributionDown.SetDefaultColor(Color.RED);
DistributionDown.SetLineWeight(3);

#ZeroLine
plot zeroline = 0;
zeroline.SetDefaultColor(Color.CYAN);
zeroline.SetStyle(Curve.LONG_DASH);
zeroline.HideTitle();
zeroline.HideBubble();

#PriceLine
Plot P = Close;
P.setdefaultColor(color.white);
Plot PC = Close;
PC.setPaintingStrategy(paintingStrategy.SQUARES);
PC.setdefaultColor(color.white);
 
could you show how to plot the close, plot the HLC3? Thanks
Code:
Declare Lower;

Plot X = HLC3("$TICK");

X.setdefaultColor(color.white);

Plot Y = HLC3("$TICK");

Y.setPaintingStrategy(paintingStrategy.SQUARES);

Y.setdefaultColor(color.white);



plot T = 1000;

plot Z = 0;

plot B = -1000;
change the close under PLOT X to HLC3 instead of "close"
 
This is the same as TOS TypicalPrice Indicator which is also useful but the main plan and idea for me was getting the histogram of the closing of the candles in the $TICK chart. Thank you.
Oh and I use the closing as squares and the typical price indicator as lines to see the divergences which is a great combination.

 
Last edited:

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