Amibroker AFL code for Bear Call and Put Spread:
You can use this AFL for Implementing Option Strategies in Amibroker.
Script:
_SECTION_BEGIN(“Bear Call and Put Spread”);
SetChartOptions(0,chartShowArrows|chartShowDates);
_N( Symbol1= ParamStr(“Strike1”, “NIFTY14MAR6000CE”) );
SetForeign( Symbol1 );
C1 = C;
H1 = H;
L1 = L;
O1 = O;
V1 = V;
RestorePriceArrays();
_N( Symbol2= ParamStr(“Strike2”, “NIFTY14MAR6400CE”) );
SetForeign( Symbol2 );
C2 = C;
H2 = H;
L2 = L;
O2 = O;
V2 = V;
RestorePriceArrays();
Color = ParamColor( “Color”, colorRed );
Style = ParamStyle( “Style”, styleLine, maskPrice );
PlotOHLC( abs(O1-O2), abs(H1-H2), abs(L1-L2), abs(C1-C2), “(” + Symbol1+” – “+Symbol2 + “) spread”, Color, style );
_SECTION_END();