Position of Arrows from a Study in Lower chart

jrandydavis

New member
Plus
Hello all. I've got a basic question about the (vertical) position of Study arrows/points/etc when used/displayed in a Lower chart.
Background: I've got one chart open with 3 subgraphs: Price, Lower, and Lower (Volume subgraph disabled via Chart Settings). Currently, the studies reside in the first Lower subgraph, which is used to display my MACD data/graph, and one looks something like this:

plot MACD_TOP = If MACD().Value[4] > MACD().Value[0] AND MACD().Value[3] > MACD().Value[0] AND MACD().Value[2] > MACD().Value[1] AND MACD().Value[1] > MACD().Value[0] MACD().Value[1] > 0

then (Low * 0.99) else Double.NaN;

MACD_TOP.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);

MACD_TOP.SetLineWeight(3);

MACD_TOP.SetDefaultColor(Color.RED);

The red arrows are positioned haphazardly (vertically) about the Lower subgraph.

Things I've tried:
** Changed the " then (xxx) else..." to MACD().Value, 0, 1, 100. These do move the arrows some, but not in the way that makes sense (to me).
** Tried Boolean arrows
** Added Declare Lower; at the beginning of the code. This only seems to add an additional and unwanted 3rd Lower chart.

I'd be happy with a way to display the arrows at the top of the subgraph, or at the bottom. Bonus would be an understanding of how to connect the arrow position to some element of the MACD graph, which I have no trouble doing when it's up in the Main/Price graph of the Chart.

Thank you,
JRD
 
Hello all. I've got a basic question about the (vertical) position of Study arrows/points/etc when used/displayed in a Lower chart.
Background: I've got one chart open with 3 subgraphs: Price, Lower, and Lower (Volume subgraph disabled via Chart Settings). Currently, the studies reside in the first Lower subgraph, which is used to display my MACD data/graph, and one looks something like this:

plot MACD_TOP = If MACD().Value[4] > MACD().Value[0] AND MACD().Value[3] > MACD().Value[0] AND MACD().Value[2] > MACD().Value[1] AND MACD().Value[1] > MACD().Value[0] MACD().Value[1] > 0

then (Low * 0.99) else Double.NaN;

MACD_TOP.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);

MACD_TOP.SetLineWeight(3);

MACD_TOP.SetDefaultColor(Color.RED);

The red arrows are positioned haphazardly (vertically) about the Lower subgraph.

Things I've tried:
** Changed the " then (xxx) else..." to MACD().Value, 0, 1, 100. These do move the arrows some, but not in the way that makes sense (to me).
** Tried Boolean arrows
** Added Declare Lower; at the beginning of the code. This only seems to add an additional and unwanted 3rd Lower chart.

I'd be happy with a way to display the arrows at the top of the subgraph, or at the bottom. Bonus would be an understanding of how to connect the arrow position to some element of the MACD graph, which I have no trouble doing when it's up in the Main/Price graph of the Chart.

Thank you,
JRD
what happens if you change then (Low * 0.99) to then 0 ? MACD is an oscillator around a 0 line
 
what happens if you change then (Low * 0.99) to then 0 ? MACD is an oscillator around a 0 line

Thank you for the reply. As per my post, I've tried MACD().Value, 0, 1, and 100 instead of (Low * 0.99). I've also tried just Value, and both adding and multiplying Value by various offsets (e.g. Value +1, Value * 1.2, etc.) and nothing seems to work. Using 0 puts the arrows at the bottom of the subgraph, but any other variation either doesn't change their positions, or does so in a way that doesn't make any sense (to me).

Also, I cleaned up my code a little using assigned/defined variables, as shown below:

Def Value = MACD().Value;
Def Avg = MACD().Avg;
Def Diff = MACD().diff;
Def MACDTopCondition =

Value[1] > 0 AND ((diff[2] / Avg[2]) >= 0.075) AND Value[0] < Value[1] AND Value[1] < Value[2] AND
Value[2] > Value[3] AND Value[3] > Value[4] AND Value[3] > Value[5];

Plot MACD_TOP = If MACDTopCondition then (Value) else Double.Nan;
MACD_TOP.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
MACD_TOP.SetLineWeight(3);
MACD_TOP.SetDefaultColor(Color.RED);

** Also, ChatGPT wanted me to try adding code like this--
Plot MACD_Value = value;
MACD_Value.SetDefaultColor(Color.black);

so that ToS would reference off of this plot instead. Even though this seemed to move the arrows some, it only seemed to complicate things more.
I'm open to any ideas. Still not sure why it's so hard to get these arrows to plot in correspondence with the graph to which they are connected.
Thank you,
JRD
 
Sorry about that. I didn't realize it is an upper study. You have an Arrow_Down and you want it to plot at the price bar it triggers. You had it with Close * some percent. Arrow Down is usually plotted off the High. Change it to High and see how that works. You can't plot is off the MACD value as that isn't related to the price at all. MACD is a much smaller value than the price, so the MACD_Value is not going to show on the Price panel unless the security price is a very low price.

This plots a down arrow at the high of the bar.

Def Value = MACD().Value;
Def Avg = MACD().Avg;
Def Diff = MACD().diff;
Def MACDTopCondition =

Value[1] > 0 AND ((diff[2] / Avg[2]) >= 0.075) AND Value[0] < Value[1] AND Value[1] < Value[2] AND
Value[2] > Value[3] AND Value[3] > Value[4] AND Value[3] > Value[5];

Plot MACD_TOP = If MACDTopCondition then high * 1.00 else Double.Nan;
MACD_TOP.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
MACD_TOP.SetLineWeight(3);
MACD_TOP.SetDefaultColor(Color.RED);

#** Also, ChatGPT wanted me to try adding code like this--
Plot MACD_Value = value;
MACD_Value.SetDefaultColor(Color.black);


If you wanted a lower study this plots the down arrow at 1 and plots the MACD_Value

declare lower;
Def Value = MACD().Value;
Def Avg = MACD().Avg;
Def Diff = MACD().diff;
Def MACDTopCondition =

Value[1] > 0 AND ((diff[2] / Avg[2]) >= 0.075) AND Value[0] < Value[1] AND Value[1] < Value[2] AND
Value[2] > Value[3] AND Value[3] > Value[4] AND Value[3] > Value[5];

Plot MACD_TOP = If MACDTopCondition then 1 else Double.Nan;
MACD_TOP.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
MACD_TOP.SetLineWeight(3);
MACD_TOP.SetDefaultColor(Color.RED);

Plot MACD_Value = value;
MACD_Value.SetDefaultColor(Color.black);
 
Sorry about that. I didn't realize it is an upper study. You have an Arrow_Down and you want it to plot at the price bar it triggers. You had it with Close * some percent. Arrow Down is usually plotted off the High. Change it to High and see how that works. You can't plot is off the MACD value as that isn't related to the price at all. MACD is a much smaller value than the price, so the MACD_Value is not going to show on the Price panel unless the security price is a very low price.

This plots a down arrow at the high of the bar.

Def Value = MACD().Value;
Def Avg = MACD().Avg;
Def Diff = MACD().diff;
Def MACDTopCondition =

Value[1] > 0 AND ((diff[2] / Avg[2]) >= 0.075) AND Value[0] < Value[1] AND Value[1] < Value[2] AND
Value[2] > Value[3] AND Value[3] > Value[4] AND Value[3] > Value[5];

Plot MACD_TOP = If MACDTopCondition then high * 1.00 else Double.Nan;
MACD_TOP.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
MACD_TOP.SetLineWeight(3);
MACD_TOP.SetDefaultColor(Color.RED);

#** Also, ChatGPT wanted me to try adding code like this--
Plot MACD_Value = value;
MACD_Value.SetDefaultColor(Color.black);


If you wanted a lower study this plots the down arrow at 1 and plots the MACD_Value

declare lower;
Def Value = MACD().Value;
Def Avg = MACD().Avg;
Def Diff = MACD().diff;
Def MACDTopCondition =

Value[1] > 0 AND ((diff[2] / Avg[2]) >= 0.075) AND Value[0] < Value[1] AND Value[1] < Value[2] AND
Value[2] > Value[3] AND Value[3] > Value[4] AND Value[3] > Value[5];

Plot MACD_TOP = If MACDTopCondition then 1 else Double.Nan;
MACD_TOP.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
MACD_TOP.SetLineWeight(3);
MACD_TOP.SetDefaultColor(Color.RED);

Plot MACD_Value = value;
MACD_Value.SetDefaultColor(Color.black);
It's a lower subgraph study. I did try the declare lower; option as mentioned in my post, but it opened another/additional lower subgraph instead of putting the arrows in the subgraph pane that contains my MACD plots. Not sure what I'm doing wrong here, but I imagine this shouldn't be so difficult...
JRD
 
It's a lower subgraph study. I did try the declare lower; option as mentioned in my post, but it opened another/additional lower subgraph instead of putting the arrows in the subgraph pane that contains my MACD plots. Not sure what I'm doing wrong here, but I imagine this shouldn't be so difficult...
JRD
you can drag it up or use the up arrows on the side to move it where you want it. Is it charting correctly?
 

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

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
1043 Online
Create Post

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