Moving Average line as a bar/candle for the time period

Status
Not open for further replies.

BlueRaven

New member
There's a few applications I would like to apply this too but I'm not sure that it's possible in TOS.

Basically I want TOS to remember the HLCO of a plotted moving average. So the MA is displayed as a bar or candle chart instead of just as a line chart.

I'm thinking it could be done with the addchart function which I use for a few studies, however I don't know how to have it store the HLCO of a number/study.

I haven't tried it yet, but I'm thinking of having it grab the data at certain times for the Open and Close and then maybe have it grab the highest high and the lowest low for a time period for the addchart function.

Do you think that would work, or is there a better way?
 
@BlueRaven I'm not sure what you mean by 'add chart function' and If such a thing exists, I would love to chart some indicators as candles.

As for storing the HLCO, if you are talking about intraday charts, here is a way to store the HLCO of each bar of a moving average:
Code:
def HI = high;
def LO = low;
def OP = open;
def CL = close;

input Length = 20;
input Average_Type = AverageType.SIMPLE;

plot LinRegH = MovingAverage(Average_Type,HI, Length);
plot LinRegL = MovingAverage(Average_Type,LO,Length);
plot LinRegC = MovingAverage(Average_Type,CL,Length);
plot LinRegO = MovingAverage(Average_Type,OP,Length);

I would like to hear more about the 'addchart' function, if it exists, that would be awesome!

Just realized this post is from 2019 LOL
 
@adii800
Here is some bare-bones informaton about the undocumented AddChart() function.
Here is an indicator that uses the AddChart() function.
A basic example:
Code:
14:54 Mobius: Example of AddChart()

declare lower;
# Add Chart
# Mobius
# Chat Room Request

def o = open(getUnderlyingSymbol());
def h = high(getUnderlyingSymbol());
def l = low(getUnderlyingSymbol());
def c = close(getUnderlyingSymbol());
AddChart(h,l,c,o,ChartType.CANDLE,color.green);
AddChart(h,l,o,c,ChartType.Candle,color.red);
Hope these give you some ideas of how this function can be useful. You can't break anything by playing w/it.
 
Last edited:
Status
Not open for further replies.

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