How to plot MA of scrip vs Sensex?

pasha

Active Member
#1
I want to plot a moving average of stock/sensex over a 10 day period.
I've tried using Plotforeign in AB, but it does'nt work.
Any ideas? Also how to plot the weekly chart so that both weekly and daily are visible in 2 panes?
 

bvpraveen

Active Member
#2
I want to plot a moving average of stock/sensex over a 10 day period. I've tried using Plotforeign in AB, but it does'nt work.
Look at the syntax of Plotforeign:
PlotForeign( tickersymbol, name, barcolor, style = styleCandle | styleOwnScale, minvalue = {empty}, maxvalue = {empty}, XShift = 0 )

You should use styleOwnScale, so that the second script is plotted on its own scale.

Also how to plot the weekly chart so that both weekly and daily are visible in 2 panes?
I think this is not possible to have it in single layout. Do this:
1) Open daily chart and save it as one layout, say dailyLayout.
2) Open weekly chart and save it as, say weeklyLayout.
Now you can easily switch between two layouts.

If this is not you are looking for, try using timeframe...() functions. Please refer to Amibroker User Guide, which has perfect documentation for these functions.

Let me know if I'm wrong anywhere.
Praveen.
 

pasha

Active Member
#4
Thanks for the replies.
When I add a custom indicator in the Indicator Builder and paste this in
" PlotForeign(BSE SENSEX, name, barcolor, style = styleCandle | styleOwnScale, minvalue = {empty}, maxvalue = {empty}, XShift = 0 )"
A syntax error occurs.
Even when "name" is changed to BSE SENSEX. What's wrong with this?
 

bvpraveen

Active Member
#5
Thanks for the replies.
When I add a custom indicator in the Indicator Builder and paste this in
" PlotForeign(BSE SENSEX, name, barcolor, style = styleCandle | styleOwnScale, minvalue = {empty}, maxvalue = {empty}, XShift = 0 )"
A syntax error occurs.
Even when "name" is changed to BSE SENSEX. What's wrong with this?
Hey...you are wrong there. What you have used is the syntax for PlotForeign.

Try this:
PlotForeign("SENSEX", "BSE Sensex", colorRed, styleCandle | styleOwnScale);

NOTE: The first parameter is the ticker symbol, ie enter the ticker symbol which you are using in your database. I've given "SENSEX" just for an eg.

Praveen.
 

pasha

Active Member
#6
Thanks Praveen, that worked perfectly.
Is it possible to plot a 10 day ema of the Sensex on top of the Sensex price too?
 

bvpraveen

Active Member
#7
Thanks Praveen, that worked perfectly.
Is it possible to plot a 10 day ema of the Sensex on top of the Sensex price too?
Hi,

Try this:
Plot(EMA(Foreign( "SENSEX", "C" ), 10), "EMA10 of SENSEX", colorGreen, styleOwnScale);

I've not tried it yet..

Praveen.
 
Last edited:

Similar threads