Anant sir have you modified AFL which has IB informed on,
can u post it here
thanks
Here is the modified (Version 1.8) AFL for Inside Bar Strategy:
_SECTION_BEGIN("INSIDEBAR");
SetChartOptions(0, chartShowDates | chartWrapTitle);
/****************************************************/
/* Variables Used in this AFL */
/* ========================== */
/* */
/* MH = Mother Bar High */
/* ML = Mother Bar Low */
/* */
/* S_Trig = The Bar on which Short Triggered */
/* L_Trig = The Bar on which Long Triggered */
/* Trig_Txt = Trigger to show in Exploration */
/* */
/* LT_Hi = High of Long Trigger Bar */
/* LT_Lo = Low of Long Trigger Bar */
/* ST_Lo = Low of Short trigger Bar */
/* ST_Hi = High of Short Trigger Bar */
/* */
/* RL = Long Trade range = LT_Hi - ML */
/* RS = Short Trade range = MH - ST_Lo */
/* */
/* L_Entry = Entry price for Long position */
/* L_Tgt = Target for Long position */
/* SL_Long = SL for Long position */
/* */
/* S_Entry = Entry price for Short position */
/* S_Tgt = Target for Short position */
/* SL_Short = SL for Short position */
/* */
/* IBDT = Date of InsideBar */
/* */
/****************************************************/
// INITIALISE VARIABLES
MH = ML = R = Null;
S_Trig = L_Trig = Null;
LT_Hi = ST_Lo = Null;
L_Entry = L_Tgt = SL_Long = Null;
S_Entry = S_Tgt = SL_Short = Null;
DT = DateTime();
// ASSIGN VALUES FOR VARIABLES
MH = ValueWhen(Inside(), Ref(H, -1), 1);
ML = ValueWhen(Inside(), Ref(L, -1), 1);
IBDT = ValueWhen(Inside(), DT, 1);
S_Trig = C < ML;
L_Trig = C > MH;
S_Trig = ExRem(S_Trig, Inside());
L_Trig = ExRem(L_Trig, Inside());
LT_Hi = ValueWhen(L_Trig, H, 1);
LT_Lo = ValueWhen(L_Trig, L, 1);
ST_Lo = ValueWhen(S_Trig, L, 1);
ST_Hi = ValueWhen(S_Trig, H, 1);
RL = LT_Hi - ML;
RS = MH - ST_Lo;
L_Entry = 1.001 * LT_Hi;
L_Entry = int((L_Entry * 2 + 0.0499) * 10) / 20;
S_Entry = 0.999 * ST_Lo;
S_Entry = int((S_Entry * 2 + 0.0499) * 10) / 20;
L_Tgt = int(((LT_Hi + RL / 2) * 2 +0.0499) * 10) / 20;
S_Tgt = int(((ST_Lo - RS / 2) * 2 +0.0499) * 10) / 20;
SL_Long = int(((LT_Hi - RL / 2) * 2 +0.0499) * 10) / 20;
SL_Short = int(((ST_Lo + RS / 2) * 2 +0.0499) * 10) / 20;
Bk_Color = IIf(L_Trig, colorPaleGreen, colorPink);
Txt_Color = IIf(L_Trig, colorGreen, colorRed);
Trig_Txt = WriteIf(L_Trig, "Go Long", WriteIf(S_Trig, "Go Short", ""));
/***********************************/
/* */
/* Display Chart */
/* */
/***********************************/
if(Status("action") == actionIndicator)
{
/****************/
/* */
/* ALERT OUTPUT */
/* */
/****************/
TxtX = Param("Text Left", 800, 0, 1000, 10);
TxtY = Param("Text Top", 70, 1, 650, 10);
GfxSelectFont("Tahoma", 14, 700 );
GfxSetBkMode(1);
if(SelectedValue(L_Trig))
{
GfxSetTextColor(colorBrightGreen);
GfxTextOut("Long Triggered", TxtX, TxtY);
GfxSelectFont("Arial", 12);
GfxTextOut("Go Long above: " + L_Entry, TxtX, TxtY + 25);
GfxTextOut("Target: " + L_Tgt, TxtX, TxtY + 50);
GfxTextOut("Stop Loss: " + SL_Long, TxtX, TxtY + 75);
}
else if(SelectedValue(S_Trig))
{
GfxSetTextColor(colorGold);
GfxTextOut("Short Triggered", TxtX, TxtY);
GfxSelectFont("Arial", 12);
GfxTextOut("Go Short below: " + S_Entry, TxtX, TxtY + 25);
GfxTextOut("Target: " + S_Tgt, TxtX, TxtY + 50);
GfxTextOut("Stop Loss: " + SL_Short, TxtX, TxtY + 75);
}
else
{
GfxSetTextColor(colorBlack);
GfxTextOut("", TxtX, TxtY);
}
Plot(C, "", colorLightGrey, styleCandle);
Plot(S_Entry, "Short below", colorLightOrange, styleDashed);
Plot(L_Entry, "Long above", colorSeaGreen, styleDashed);
// Plot(IIf(L_Entry, L_Tgt, IIf(S_Entry, S_Tgt, Null)), "Target", colorLightBlue, styleLine);
// Plot(IIf(L_Entry, SL_Long, IIf(S_Entry, SL_Short, Null)), "Stop Loss", colorYellow, styleLine);
PlotShapes(shapeHollowSmallCircle * Inside(), colorYellow, 0, L);
PlotShapes(shapeHollowSmallUpTriangle * L_Trig, colorYellow, 0, L);
PlotShapes(shapeHollowSmallDownTriangle * S_Trig, colorYellow, 0, H);
_N(Title = "Inside Bar Trading Strategy: Concept by Karthik.\n"
+ EncodeColor(colorSkyblue) + "AFL Version 1.8 coded by Anant Navale.\n"
+ StrFormat("{{NAME}} ({{INTERVAL}}), {{DATE}}; {{OHLCX}}; Vol = %1.0f \n", V)
+ EncodeColor(colorYellow) + WriteIf(Inside(), "Inside Bar. Wait for Trigger candle.", ""));
}
if(Status("action") == actionExplore)
{
Filter = (L_Trig OR S_Trig);
SetOption("NoDefaultColumns", True);
AddTextColumn(Name(), "SYMBOL", 77, colorBlue, Bk_Color, 125);
AddColumn(LastValue(IBDT), "IB FORMED ON", formatDateTime, colorBlue, Bk_Color, 100);
AddColumn(DateTime(), "TRIGGER DATE", formatDateTime, colorBlue, Bk_Color, 120);
AddTextColumn(Trig_Txt, "Trigger", 77, colorBlue, Bk_Color);
AddColumn(IIf(L_Trig, L_Entry, S_Entry), "Entry Price", 1.2, IIf(L_Trig, colorDarkGreen, colorRed), Bk_color, 80);
AddColumn(IIf(L_Trig, L_Tgt, S_Tgt), "Target", 1.2, colorDefault, Bk_Color, 80);
AddColumn(IIf(L_Trig, SL_Long, SL_Short), "Stop Loss", 1.2, colorBlue, Bk_Color, 80);
AddColumn(C, "C. M. P.", 1.2, colorBlue, Bk_Color,80);
}
_SECTION_END();
-Anant