• LIMITED TIME ONLY: Take $40 off VIP with code: BTD40.

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

Not open for further replies.


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


Staff member
Here is some bare-bones informaton about the undocumented AddChart() function.
Here is an indicator that uses the AddChart() function.
A basic example:
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());
Hope these give you some ideas of how this function can be useful. You can't break anything by playing w/it.
Last edited:
Not open for further replies.

Similar threads