Click here to Login

                                                   Using getseries to calculate ema


2019-08-29 21:49:47


I'm trying to use a filter rule that gets the series for the SPY ETF and calculates an EMA to see if the SPY is closing above it's 75 average.

spy = getseries("SPY", close);
rule1 = spy > ema(spy,75);

Is this the correct way to express it ?

Also, if I want to see this formula expressed in a pane, is this the correct way of doing it ?

symbol = "SPY";
close1 = GetSeries(symbol, close);
open1 = GetSeries(symbol, open);
high1 = GetSeries(symbol, high);
low1 = GetSeries(symbol, low);

PlotCandleStick1(open1, high1, low1, close1, symbol, colorBlack, StyleOwnScale);
PrintChart(symbol, "", BottomLeft, colorBlack, colorTransparent, colorTransparent, 255);

symbol = "SPY";
close1 = GetSeries(symbol, close);
a = Ema(close1, 75);
Plot(a, "EMA", colorBlue, chartLine, StyleWidth2);


2019-09-02 21:41:08


Yes, it is correct. You can check that by plotting it on a chart.

2019-09-03 17:56:45


When using the pane as described above, I notice that if I zoom in/out using de number of bars slider, the EMA changes position. Is there a way to avoid this behaviour?


2019-09-12 10:59:54


Best Answer
Yes, you need to replace "StyleOwnScale" style in the formula with something like "StyleSymbolNone" to force the plot to use the default scale.

2019-09-12 16:50:45


Thanks ! That worked.

No more messages


No html code. URLs turn into links automatically.

Type in the trading objects you want to include: - Add Objects
To add a trading object in your message, type in the object name, select it and then click on "Add Objects"


Trading Items
Stock market prediction using traderbots
Double / Triple Smoothened EMA with Flexible Alpha
Sentiment Measure Using ETF Sector Correlations
Stock Ranking using Rate of Change and SMA Volume
Put-Call Ratio Index using Market Makers Trades

How-to Lessons
How to calculate the average of a time series using the money man...
How to draw an horizontal segment line using QS language
How to plot a stock using different periods in the same chart
How to debug a trading system using the money management tool
How to get stocks for a particular index using the global script

Related Forum Threads
Calculate total volatility of portfolio
Finding horizontal Support/Resistence lines using AutoSR
Ranking using Pivot Tables
Stock Ranking using ... object
Buy-sell rules using a composite

Blog Posts
Technical Analysis Using Multiple Timeframes
How to create a trading system, screen and composite using earnin...
Backtesting chart patterns using the auto support and resistance ...
Forecast volatility using trading rules and neural networks
How to predict and trade the stock market using pivot points

Create an account
Affiliate Program
Contact Us
Trading Forum
How-to Lessons
About Us
Terms of Use

Copyright 2020
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Follow us on Google+
RSS Trading Items

Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.