How do I add up all plotted values?

gomi111

New member
I am using Renko bars and made a bubble at the end of every run with a modified total count. How do I add up all the total values of all the bubbles? upFinal and downFinal separated if possible. Thanks

15090[/ATTACH]']
mKb9ToJ.png


Code:
#
#RENKO COUNT
#

def upBar = close > close[1];
def downBar = close < close[1];

def upStart = downBar[1] and upBar;
def upCount = if upStart then 1 else if upBar then upCount[1] + 1 else double.nan;
def upStop = if upBar[1] and downBar then upCount[1] else double.nan;
def upFinal = upStop - 3;
AddChartBubble (upFinal[-1], high, upFinal[-1], color.green);

#def upSum = totalSum(upFinal);
#addlabel (yes, upSum, color.yellow);


def downStart = upBar[1] and downBar;
def downCount = if downStart then 1 else if downBar then downCount[1] + 1 else double.nan;
def downStop = if downBar[1] and upBar then downCount[1] else double.nan;
def downFinal = downStop - 3;
AddChartBubble (downFinal[-1], close, downFinal[-1], color.red);

To simplify my question... How do add the previous value and current value of a variable?
 

Attachments

  • mKb9ToJ.png
    mKb9ToJ.png
    26.6 KB · Views: 93
Last edited:
Solution
I am using Renko bars and made a bubble at the end of every run with a modified total count. How do I add up all the total values of all the bubbles? upFinal and downFinal separated if possible. Thanks

15094[/ATTACH]']
mKb9ToJ.png


Code:
#
#RENKO COUNT
#

def upBar = close > close[1];
def downBar = close < close[1];

def upStart = downBar[1] and upBar;
def upCount = if upStart then 1 else if upBar then upCount[1] + 1 else double.nan;
def upStop = if upBar[1] and downBar then upCount[1] else double.nan;
def upFinal = upStop - 3;
AddChartBubble (upFinal[-1], high, upFinal[-1], color.green);

#def upSum = totalSum(upFinal);
#addlabel (yes, upSum, color.yellow);


def downStart = upBar[1] and downBar;
def downCount = if downStart then 1...
I am using Renko bars and made a bubble at the end of every run with a modified total count. How do I add up all the total values of all the bubbles? upFinal and downFinal separated if possible. Thanks

15094[/ATTACH]']
mKb9ToJ.png


Code:
#
#RENKO COUNT
#

def upBar = close > close[1];
def downBar = close < close[1];

def upStart = downBar[1] and upBar;
def upCount = if upStart then 1 else if upBar then upCount[1] + 1 else double.nan;
def upStop = if upBar[1] and downBar then upCount[1] else double.nan;
def upFinal = upStop - 3;
AddChartBubble (upFinal[-1], high, upFinal[-1], color.green);

#def upSum = totalSum(upFinal);
#addlabel (yes, upSum, color.yellow);


def downStart = upBar[1] and downBar;
def downCount = if downStart then 1 else if downBar then downCount[1] + 1 else double.nan;
def downStop = if downBar[1] and upBar then downCount[1] else double.nan;
def downFinal = downStop - 3;
AddChartBubble (downFinal[-1], close, downFinal[-1], color.red);

To simplify my question... How do add the previous value and current value of a variable?

This displays the sum in bubbles and labels

Capture.jpg
Ruby:
#
#RENKO COUNT
#

def upBar   = close > close[1];
def downBar = close < close[1];

def upStart = downBar[1] and upBar;
def upCount = if upStart then 1 else if upBar then upCount[1] + 1 else Double.NaN;
def upStop  = if upBar[1] and downBar then upCount[1] else Double.NaN;
def upFinal = upStop - 3;
def xup     = if !IsNaN(upFinal[-1]) then xup[1] + upFinal[-1] else xup[1];
AddChartBubble(upFinal[-1],
                if xup== 0 then Double.NaN
                else high,
                upFinal[-1] + " \n" + xup, Color.GREEN);

AddLabel (yes, "Sum UP: " + xup, Color.green);


def downStart = upBar[1] and downBar;
def downCount = if downStart then 1 else if downBar then downCount[1] + 1 else Double.NaN;
def downStop  = if downBar[1] and upBar then downCount[1] else Double.NaN;
def downFinal = downStop - 3;
def xdn       = if !IsNaN(downFinal[-1]) then xdn[1] + downFinal[-1] else xdn[1];
AddChartBubble (downFinal[-1],
                if xdn == 0 then Double.NaN
                else low,
                downFinal[-1] + "\n" + xdn, Color.RED, no);

addlabel(1, "Sum DOWN: " + xdn, color.red);
 

Attachments

  • mKb9ToJ.png
    mKb9ToJ.png
    26.6 KB · Views: 92
Solution

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