# Plotting foreign symbol - AFL HELP NEEDED

#### Aman03

##### Member
Hi seniors,

I am able to plot 2 symbols in one chart using the formula:

PlotForeign( "JUSTDIAL-I", "JUSTDIAL", colorRed, styleBar );

--------

2 symbols ploted in my chart are: HDFC-I & JUSTDIAL-I

How shall I plot the average of both the symbols.

AFL
__________________________________
_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();

PlotForeign( "JUSTDIAL-I", "JUSTDIAL", colorRed, styleBar );
______________________________________

#### casoni

##### Well-Known Member
Hello,
check this .....

SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", 2, styleCandle );
_SECTION_END();

p1 = ParamStr("Index","CNXNifty");
Ind1 = Foreign(p1,"C",True);
Plot(Ind1,"\n("+P1+")",3,1|styleownScale);

p2 = ParamStr("Fut","ACC-I");
Ind2 = Foreign(p2,"C",True);
Plot(Ind2,"\n("+P2+")",6,1|styleOwnScale);

#### Aman03

##### Member
Hello,
check this .....

SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", 2, styleCandle );
_SECTION_END();

p1 = ParamStr("Index","CNXNifty");
Ind1 = Foreign(p1,"C",True);
Plot(Ind1,"\n("+P1+")",3,1|styleownScale);

p2 = ParamStr("Fut","ACC-I");
Ind2 = Foreign(p2,"C",True);
Plot(Ind2,"\n("+P2+")",6,1|styleOwnScale);
----------------

Thanks,

I tried but this doesn't work. It doesn't plot the second symbol and no avg is plotted.
===========================

#### sr114

##### Well-Known Member
----------------

Thanks,

I tried but this doesn't work. It doesn't plot the second symbol and no avg is plotted.
===========================

Here is the code - u have to put the ave or how u define the avg?

_SECTION_BEGIN("Background_Setting");
ParamColor("BgBottom", colorDarkGrey),ParamColor("TitleBack",colorGrey40));
SetChartBkColor(ParamColor("Outer Panel",colorBlack));
SetChartOptions(0,chartShowArrows|chartShowDates);
_SECTION_END();

_SECTION_BEGIN("Price _ 1st Symnol");
Index1 = ParamStr("Scrip 1", "CNX BANK");
idx1=Foreign(Index1,"C");
PlotForeign(Index1,Name(),colorGold,1 |styleThick|styleOwnScale);
_SECTION_END();

_SECTION_BEGIN("Price _ 2nd Symnol");
index2 = ParamStr("Scrip 2", "NIFTY_I");
idx2=Foreign(Index2,"C");
PlotForeign(Index2,index2,colorSkyblue,styleLine |styleThick|styleOwnScale);
_SECTION_END();
THrough the parameters window put ur scrip name in the respective scrip 1 and scrip 2

Last edited:

#### sairam111

##### New Member
hello sir

i want gann 2 bar swing chart AFL with buy and sell exploration.

i.e when previous swing crossed ,shoul give signal.

thanking you sir.