Add 2% +/-

DoQtorNo

Member
VIP
hello,

im looking to keep script as such just simply add 2% plus and minus to this existing script..

thankyou.
Code:
input daily_percent_bubbles = yes;

input Move_bubble_left = 33; #hint Move_bubble_left: This will move the Weekly EM Bubbles left and right
input bubble_left = 15; #hint bubble_left: This will move the % Bubbles left and right
input ShowTodayOnly = yes;
input lite_chart = yes;
def showPlot = !ShowTodayOnly ;
def nMinutes = GetAggregationPeriod() / 60000;

def lastBar = SecondsFromTime(1600) >= 0 and SecondsFromTime(1600) < nMinutes * 60;
def bar2open = if lastBar then open else bar2open[1];
def bar2high = if lastBar then high else bar2high[1];
def bar2low = if lastBar then low else bar2low[1];
def bar2close = if lastBar then close else bar2close[1];
#plot b2c = if !showPlot then Double.NaN else bar2open;
# b2c.AssignValueColor(if lite_chart then Color.black else Color.white);
# b2c.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
#input paintBars = yes;
def na = Double.NaN; # "/NQ:XCME"
def NasOnly = if GetSymbol() == "/NQ:XCME" or GetSymbol() == "/MNQ:XCME" then 1 else 0;

def SPOnly = if GetSymbol() == "/ES:XCME" or GetSymbol() == "/MES:XCME" then 1 else 0;
def SPX_Only = if GetSymbol() == "SPX" then 1 else 0;
def barsAgo = 5;

def bn = BarNumber();
script barsAgo {
input n = 0;
def bn = BarNumber();
def c = close;
def barsBack = if !IsNaN(c[-n]) && IsNaN(c[-(n + 1)]) then bn else barsBack[1];
plot barsAgo = barsBack;}


def PH = high(period = AggregationPeriod.DAY)[1];
def PL = low(period = AggregationPeriod.DAY)[1];
def PC = close(period = AggregationPeriod.DAY)[1];
def close = bar2open;

def PP = (PH + PL + PC) / 3;
def Up_one_pct = close + (close / 100);
def Up_Half = close + (close / 200);
def Dwn_one_pct = close - (close / 100);
def p_close = close;
def Dwn_half = close - (close / 200);
def up_150 = close + ((close * 1.5)*0.01);
def Dn_150 = close - ((close * 1.5)*0.01);




plot one_pct;
plot percent_150;
plot neg_pct_150;
plot halfone_pct;
plot one_pcb;
plot halfone_pcb;
plot floor_pivot;

if ShowTodayOnly and !IsNaN(close(period = AggregationPeriod.DAY)[-1])
then {
floor_pivot = Double.nan;
percent_150 = double.nan;
neg_pct_150 = double.nan;
one_pct = Double.NaN;
halfone_pct = Double.NaN;
one_pcb = Double.NaN;
halfone_pcb = double.nan; } else {
floor_pivot = PP;
neg_pct_150 = Dn_150;
percent_150 = up_150;
one_pct = Up_one_pct;
halfone_pct = Up_Half ;
one_pcb = Dwn_one_pct;
halfone_pcb = Dwn_half;}

floor_pivot .SetDefaultColor(CreateColor(150, 0, 150)); #Custom Plum
floor_pivot .SetPaintingStrategy(PaintingStrategy.POINTS);
floor_pivot .setlineweight(1);
AddChartBubble(bn == barsAgo(bubble_left) and daily_percent_bubbles,
(floor_pivot ), "Floor Pivot \n" , Color.WHITE);




percent_150 .SetDefaultColor(CreateColor(18, 109, 193));
percent_150 .SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
percent_150 .setlineweight(1);
AddChartBubble(bn == barsAgo(bubble_left) and daily_percent_bubbles,
(percent_150 ), "1.50% \n" , Color.light_green);

one_pct .SetDefaultColor(CreateColor(18, 109, 193));
one_pct .SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
one_pct .setlineweight(1);
AddChartBubble(bn == barsAgo(bubble_left) and daily_percent_bubbles,
(one_pct ), "1.00% \n" , Color.light_green);

halfone_pct .SetDefaultColor(CreateColor(18, 109, 193));
halfone_pct .SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
halfone_pct .setlineweight(1);
AddChartBubble(bn == barsAgo(bubble_left) and daily_percent_bubbles,
(halfone_pct ), "0.50% \n" , Color.light_green);

neg_pct_150 .SetDefaultColor(CreateColor(18, 109, 193));
neg_pct_150 .SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
neg_pct_150 .setlineweight(1);
AddChartBubble(bn == barsAgo(bubble_left) and daily_percent_bubbles,
(neg_pct_150 ), "-1.50% \n" , Color.pink);

one_pcb .SetDefaultColor(CreateColor(18, 109, 193));
one_pcb .SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
one_pcb .setlineweight(1);
AddChartBubble(bn == barsAgo(bubble_left) and daily_percent_bubbles,
(one_pcb ), "-1.00% \n" , Color.pink);

halfone_pcb .SetDefaultColor(CreateColor(18, 109, 193));
halfone_pcb .SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
halfone_pcb .setlineweight(1);
AddChartBubble(bn == barsAgo(bubble_left) and daily_percent_bubbles,
(halfone_pcb ), "-0.50% \n" , Color.pink);






#### Example of adding a second line of code in the bubble
#AddChartBubble(bn == barsAgo(left_right), (pCLOSE_spx + labelup_dn), "P week close \n"+asdollars(SPX_WKC),Color.white);




## OneNote Archive Name: Globex High Low Lines _v02 _11_09_2018 _JQ
## Archive Section: Uncategorized
## Suggested Tos Name using JQ naming convention: GlobexHighLowLines_v02_11_09_2018_JQ
## Archive Date: 11.09.2018
## Archive Notes: See notes below
## End OneNote Archive Header

# Script Notes
# This is a portion of a larger Mobius Script
# GlobeX or Overnight High / Low without Fibonacci Values
# Based on code by Mobius # V01.2012
# alterations by Johnny Quotron
# 1. removal of fib lines
# 2. paint ONL bubble below the line
# 3. addition of other comments
# 4. addition of bubbles in the expansion area if desired
# Restrictions: Hi / Low lines are not drawn for non-traded indicies such as VIX or TNX..JQ

declare upper;
Declare Hide_On_Daily;


#Script Name Label




# X-Axis Bubble Locations
def ExpansionBars = HighestAll(BarNumber()) - BarNumber();
#AddLabel(displayBarNumberLabels, "ExpansionBars: " + ExpansionBars, Color.LIME);
def FarRightExpansionBar = barnumber() == highestall(barnumber()) ;
#AddLabel(displayBarNumberLabels, "FarRightExpansionBar: " + FarRightExpansionBar, Color.LIME);
def ExpansionMidpointBar = Round(BarNumber() + (ExpansionBars / 2), 0);
#AddLabel(displayBarNumberLabels, "ExpansionMidpointBar: " + ExpansionMidpointBar, Color.LIME);
def CurrentBar = !IsNaN(open) and IsNaN(open [-1] ) ;
#AddLabel(displayBarNumberLabels, "CurrentBar: " + CurrentBar, Color.LIME);
def FirstBar = if BarNumber() == 1 then 1 else 0;
#AddLabel(displayBarNumberLabels, "FirstBar: " + FirstBar, Color.LIME);
def RTH_OpenBar = if GetTime() crosses above RegularTradingStart(GetYYYYMMDD()) then BarNumber() else Double.NaN;
#AddLabel(displayBarNumberLabels, "RTH_OpenBar: " + RTH_OpenBar, Color.LIME);
def RTH_MidpointBar = Round(((RTH_OpenBar + CurrentBar) / 2), 0);
#AddLabel(displayBarNumberLabels, "RTH_MidpointBar: " + RTH_MidpointBar, Color.LIME);
def RTH_ThreeQuarterBar = Round(((RTH_MidpointBar + CurrentBar) / 2), 0);
#AddLabel(displayBarNumberLabels, "RTH_ThreeQuarterBar: " + RTH_ThreeQuarterBar, Color.LIME);
def RTH_CloseBar = if GetTime() crosses above RegularTradingEnd(GetYYYYMMDD()) then BarNumber() else Double.NaN;
#AddLabel(displayBarNumberLabels, "RTH_CloseBar: " + RTH_CloseBar, Color.LIME);
def ExtendedMidpointBar = Round(((FirstBar + CurrentBar) / 2), 0);
#AddLabel(displayBarNumberLabels, "ExtendedMidpointBar: " + ExtendedMidpointBar, Color.LIME);
def ExtendedThreeQuarterBar = Round(((ExtendedMidpointBar + CurrentBar) / 2), 0);
#AddLabel(displayBarNumberLabels, "ExtendedThreeQuarterBar: " + ExtendedThreeQuarterBar, Color.LIME);

def bar = BarNumber();
def GlobeX = GetTime() < RegularTradingStart(GetYYYYMMDD());
def RTHstart = GetTime() crosses above RegularTradingStart(getYYYYMMDD());
def RTHstartBar = if barnumber() == RTHstart then barnumber() else highestall(RTHStartBar);
 
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
302 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