Plotting Daily EMA on Intra day charts

crscrs85

Member
I added a aggregationPeriod input to the EMA coding so i can view the location of the daily EMA on intra day charts. It accepted the coding and gave me the option to
change the aggregationPeriod using the gear icon but it didnt change on the chart. Any suggestions?


input AggregationPeriod = AggregationPeriod.DAY;

input price = close;
input length = 9;
input displace = 0;
input showBreakoutSignals = no;

plot AvgExp = ExpAverage(price[-displace], length);
 
Solution
I added a aggregationPeriod input to the EMA coding so i can view the location of the daily EMA on intra day charts. It accepted the coding and gave me the option to
change the aggregationPeriod using the gear icon but it didnt change on the chart. Any suggestions?


input AggregationPeriod = AggregationPeriod.DAY;

input price = close;
input length = 9;
input displace = 0;
input showBreakoutSignals = no;

plot AvgExp = ExpAverage(price[-displace], length);

This will let you see how to use aggregationperiod when you use an input for price.

Code:
[CODE]input AggregationPeriod = AggregationPeriod.DAY;
input price = fundamentalType.CLOSE;
input length = 9;
input displace = 0;
input showBreakoutSignals = no;
plot AvgExp =...
I added a aggregationPeriod input to the EMA coding so i can view the location of the daily EMA on intra day charts. It accepted the coding and gave me the option to
change the aggregationPeriod using the gear icon but it didnt change on the chart. Any suggestions?


input AggregationPeriod = AggregationPeriod.DAY;

input price = close;
input length = 9;
input displace = 0;
input showBreakoutSignals = no;

plot AvgExp = ExpAverage(price[-displace], length);

This will let you see how to use aggregationperiod when you use an input for price.

Code:
[CODE]input AggregationPeriod = AggregationPeriod.DAY;
input price = fundamentalType.CLOSE;
input length = 9;
input displace = 0;
input showBreakoutSignals = no;
plot AvgExp = ExpAverage(fundamental(price, period = aggregationPeriod)[-displace], length);

Otherwise if you do not need an input option for price you can use close(period=aggregationperiod)

Code:
[CODE]input AggregationPeriod = AggregationPeriod.DAY;
input length = 9;
input displace = 0;
input showBreakoutSignals = no;
plot AvgExp = ExpAverage(close(period = aggregationPeriod)[-displace], length);
 
Solution

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Hi SleepyZ,
I am trying to add timeframe to one of my existing study . Its giving me error . not sure what i am missing. can you pls help

# Working fine
input price = close;
input ema5=5;
input displace = 0;
def ema5p = ExpAverage(price[-displace], ema5);

When i adding timeframe , not compiling
input price = close;
input ema5=5;
input displace = 0;
def ema5p = ExpAverage(price[-displace], ema5);
input aggregationPeriod = AggregationPeriod.TEN_MIN;
def ema5pCopy = ExpAverage(fundamental(price, period = aggregationPeriod)[-displace], ema5);
def ema5Pnew =ExpAverage(price(period = aggregationPeriod)[-displace], ema5);

Appreciate any help
Sai
1729150506570.png
 
Hi SleepyZ,
I am trying to add timeframe to one of my existing study . Its giving me error . not sure what i am missing. can you pls help

# Working fine
input price = close;
input ema5=5;
input displace = 0;
def ema5p = ExpAverage(price[-displace], ema5);

When i adding timeframe , not compiling
input price = close;
input ema5=5;
input displace = 0;
def ema5p = ExpAverage(price[-displace], ema5);
input aggregationPeriod = AggregationPeriod.TEN_MIN;
def ema5pCopy = ExpAverage(fundamental(price, period = aggregationPeriod)[-displace], ema5);
def ema5Pnew =ExpAverage(price(period = aggregationPeriod)[-displace], ema5);

Appreciate any help
Sai
View attachment 23153


When adding an agg to an input price, use the fundamental function as follows:

Code:
input price = FundamentalType.CLOSE;
input ema5 = 5;
input displace = 0;
def ema5p = ExpAverage(Fundamental(price)[-displace], ema5);
input aggregationPeriod = AggregationPeriod.TEN_MIN;
def ema5pCopy = ExpAverage(Fundamental(price, period = aggregationPeriod)[-displace], ema5);
def ema5Pnew  = ExpAverage(Fundamental(price, period = aggregationPeriod)[-displace], ema5);
 
When adding an agg to an input price, use the fundamental function as follows:
Awesome SleepyZ. I can able t plot them properly with new code you provided. THANK YOU .

I am thinking what is the real use of Aggregation period when we dont have any multi Timeframe logic on our study ?

I believe While plotting study on chart Chart time frame can be used for EMA calculation . While order entry the timeframe we are choosing on order entry will be used for EMA calculation .
Whether the Extended period should be used for EMA calculation is also driven from the selections from chart / order entry.

1729215474540.png


The only use i can think of having aggregation is if our buy signal on 10 Min ema , if we want to add 1 hour based condition , we need to use aggregation period for 1 hour where 10 min is already derived from where we are using this(PLot/order)

Am i thinking correct?
 
Correct. MTF functions are used to add higher timeframes conditions to a plot in a study.

Incorrect. MTF functions cannot be added to conditional orders, scans, watchlists or any other ToS widgets.
The ToS app does not provide for the ability to use secondary aggregations in widgets. They ONLY can be used in studies, plotted on a chart.
 
  • Hot
Reactions: Sai

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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