Modify script to work on mobile

splat

New member
VIP
Can somone please help me to change this code to remove the chart bubles and replace them with .BOOLEAN_ARROW so it will display the arrows on mobile platform, I know the label wont work but I really want the arrows.

def RTH = getTime() >= regularTradingStart(getYYYYMMDD()) and
getTime() <= regularTradingEnd(getYYYYMMDD());

def o = if RTH and !RTH[1]
then open("$ADndd")
else o[1];

def c = if isNaN(close("$ADndd"))
then c[1]
else close("$ADndd");

def x = barNumber();
def sumx = if RTH and !RTH[1]
then 1
else if RTH then sumx[1] + 1
else if !RTH
then sumx[1]
else sumx[1];

def sumAD = if RTH and !RTH[1]
then c
else if RTH
then sumAD[1] + c
else sumAD[1];

def h = if isNaN(high("$ADndd", "DAY"))
then h[1]
else high("$ADndd", "DAY");

def ADHighBar = if high("$ADndd") == h
then x
else double.nan;

AddChartBubble(barNumber() == HighestAll(ADHighBar),
high + (2 * TickSize()),
"AD",
color.cyan);

def l = if isNaN(low("$ADndd", "DAY"))
then l[1]
else low("$ADndd", "DAY");

def ADLowBar = if low("$ADndd") == l
then x
else double.nan;

AddChartBubble(barNumber() == HighestAll(ADLowBar),
low - (2 * TickSize()),
"AD",
color.orange,
no);

def Avg = Round(sumAD / sumx, 0);

addLabel(1, "AD open " + o +

" high " + h +

" low " + l +

" close " + c +

" Avg " + Avg, if c < 0

then color.red

else color.green);

# End Code AD Label

Can somone please help me to change this code to remove the chart bubles and replace them with .BOOLEAN_ARROW so it will display the arrows on mobile platform, I know the label wont work but I really want the arrows.

def RTH = getTime() >= regularTradingStart(getYYYYMMDD()) and
getTime() <= regularTradingEnd(getYYYYMMDD());

def o = if RTH and !RTH[1]
then open("$ADndd")
else o[1];

def c = if isNaN(close("$ADndd"))
then c[1]
else close("$ADndd");

def x = barNumber();
def sumx = if RTH and !RTH[1]
then 1
else if RTH then sumx[1] + 1
else if !RTH
then sumx[1]
else sumx[1];

def sumAD = if RTH and !RTH[1]
then c
else if RTH
then sumAD[1] + c
else sumAD[1];

def h = if isNaN(high("$ADndd", "DAY"))
then h[1]
else high("$ADndd", "DAY");

def ADHighBar = if high("$ADndd") == h
then x
else double.nan;

AddChartBubble(barNumber() == HighestAll(ADHighBar),
high + (2 * TickSize()),
"AD",
color.cyan);

def l = if isNaN(low("$ADndd", "DAY"))
then l[1]
else low("$ADndd", "DAY");

def ADLowBar = if low("$ADndd") == l
then x
else double.nan;

AddChartBubble(barNumber() == HighestAll(ADLowBar),
low - (2 * TickSize()),
"AD",
color.orange,
no);

def Avg = Round(sumAD / sumx, 0);

addLabel(1, "AD open " + o +

" high " + h +

" low " + l +

" close " + c +

" Avg " + Avg, if c < 0

then color.red

else color.green);

# End Code AD Label
I changed it to this and it works but still not on mobile tos

def RTH = getTime() >= regularTradingStart(getYYYYMMDD()) and
getTime() <= regularTradingEnd(getYYYYMMDD());

def o = if RTH and !RTH[1]
then open("$ADndd")
else o[1];

def c = if isNaN(close("$ADndd"))
then c[1]
else close("$ADndd");

def x = barNumber();
def sumx = if RTH and !RTH[1]
then 1
else if RTH then sumx[1] + 1
else if !RTH
then sumx[1]
else sumx[1];

def sumAD = if RTH and !RTH[1]
then c
else if RTH
then sumAD[1] + c
else sumAD[1];

def h = if isNaN(high("$ADndd", "DAY"))
then h[1]
else high("$ADndd", "DAY");

def ADHighBar = if high("$ADndd") == h
then x
else double.nan;

plot bullishArrow = barNumber() == HighestAll(ADHighBar);
bullishArrow.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_down);
bullishArrow.SetDefaultColor(Color.CYAN);

def l = if isNaN(low("$ADndd", "DAY"))
then l[1]
else low("$ADndd", "DAY");

def ADLowBar = if low("$ADndd") == l
then x
else double.nan;

plot bearishArrow = barNumber() == HighestAll(ADLowBar);
bearishArrow.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_up);
bearishArrow.SetDefaultColor(Color.ORANGE);

def Avg = Round(sumAD / sumx, 0);

# End Code AD Label
 
Last edited by a moderator:

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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