Please add NIFTY CALL AND PUT ON SAME CHART

#1
Hi friends

Here is afl for nifty and a call of nifty
I like to add a nifty put also.
The idea is to see both call and put on same chart.
can anybody modify the code please
my code follows as in amibroker
some problem is there.
regards
ford

HTML:
_SECTION_BEGIN("Relative Performance");

_N( TickerList = ParamStr("Tickers", "NIFTY,NIFTY30MAY2013 5700.00CE ") );



NumBars = 20;
fvb = Status("firstvisiblebar");
Plot( 100 * ( C - C[ fvb ] ) / C[ fvb ], Name(), colorBlue );
for( i = 0; ( symbol = StrExtract( TickerList, i ) ) != ""; i++ )
{
 fc = Foreign( symbol, "C" );

 if( ! IsNull( fc[ 0 ] ) )
 {
   Plot( 100 * ( fc - fc[ fvb ] )/ fc[ fvb ], symbol, colorLightOrange + ( (2*i) % 15 ), styleLine );
 }
}
PlotGrid( 0, colorYellow );
_N( Title = "{{NAME}} - Relative Performance [%]: {{VALUES}}" );
_SECTION_END();
 
#2
Hi friends

Here is afl for nifty and a call of nifty
I like to add a nifty put also.
The idea is to see both call and put on same chart.
can anybody modify the code please
my code follows as in amibroker
some problem is there.
regards
ford

HTML:
_SECTION_BEGIN("Relative Performance");

_N( TickerList = ParamStr("Tickers", "NIFTY,NIFTY30MAY2013 5700.00CE ") );



NumBars = 20;
fvb = Status("firstvisiblebar");
Plot( 100 * ( C - C[ fvb ] ) / C[ fvb ], Name(), colorBlue );
for( i = 0; ( symbol = StrExtract( TickerList, i ) ) != ""; i++ )
{
 fc = Foreign( symbol, "C" );

 if( ! IsNull( fc[ 0 ] ) )
 {
   Plot( 100 * ( fc - fc[ fvb ] )/ fc[ fvb ], symbol, colorLightOrange + ( (2*i) % 15 ), styleLine );
 }
}
PlotGrid( 0, colorYellow );
_N( Title = "{{NAME}} - Relative Performance [%]: {{VALUES}}" );
_SECTION_END();

No need to change the code, add all the tickers you want (i.e. both puts / calls) to the parameter . . .

or if you insist on hard-coding then use something like

Code:
_N( TickerList = ParamStr("Tickers", "NIFTY,NIFTY30MAY2013 6300.00CE,NIFTY30MAY2013 6200.00PE") );
Just make sure the ticker name for PE/CE is correct :)



Cheers
::thumb::
 
#3
hi friend
Thank you for the code line.
somehow it fails to work.only on line comes,it doesnt pick up s4econd option symbol.

regards
ford
 

casoni

Well-Known Member
#4
Hello ,
Lookiing for something like this ..


http://i.imgur.com/oBY9pon.png

if yes , then here's the code .. change tickerA/tickerB as per your
requirement

tickerA = ParamStr( "TickerA", "LT" );
tickerB = ParamStr( "TickerB", "SBIN" );
sp = Param( "MA Period", 12, 2, 100,1 );
PlotForeign( tickerA, "Chart of "+tickerA,ParamColor( "Price ColorA", colorGreen ), styleLine |styleOwnScale|styleNoLabel);
PlotForeign( tickerB, "Chart of "+tickerB,ParamColor( "Price ColorB", colorRed ), styleLine |styleOwnScale|styleNoLabel);

Plot( MA( Foreign( tickerA, "C" ), sp ), "MA", ParamColor( "MA ColorA", colorLime ) ,32|styleOwnScale|styleNoLabel);
Plot( MA( Foreign( tickerB, "C" ), sp ), "MA", ParamColor( "MA ColorB", colorOrange ) ,32|styleOwnScale|styleNoLabel);
 
#5
hI Casoni
Thanks for the code & YOUR EFFORT TO HELP ME.

It is working fine for stocks.
I am getting my option data from cdequi odin.
The trouble seems to be with symbol name and my manual feeding of symbol.

If there is a way system picking symbol then it may work,possibly.

Sorry for the trouble
best regards
ford
PS The symbol name I have used is in the format of NIFTY27JUN2013 5900.00CE-just for your info.
 

casoni

Well-Known Member
#6
hI Casoni
Thanks for the code & YOUR EFFORT TO HELP ME.

It is working fine for stocks.
I am getting my option data from cdequi odin.
The trouble seems to be with symbol name and my manual feeding of symbol.

If there is a way system picking symbol then it may work,possibly.

Sorry for the trouble
best regards
ford
PS The symbol name I have used is in the format of NIFTY27JUN2013 5900.00CE-just for your info.
in tickerA
use your symbol .i.e NIFTY27JUN2013 5900.00CE
and in tickerB use another symbol

check if this helps..
if it dosen't i can check via team viewr
 

Similar threads