li

Amibroker AFL Price Breakout Detection

Download updated EOD, IEOD Data of Nifty and FNO stocks for Amibroker and Metastock [Download here]. Submit correct details and only one copy to one person. Please don't spam.

Amibroker AFL for Price Breakout Detection. AFL can be used to find out horizontal support and resistance lines for detecting the price breakouts.

 

_SECTION_BEGIN(“BREAK OUTS”);

// ============== Standard Chart Code ============================
CodeName = “Rasheed’s Breakouts”;
SetFormulaName(“Rasheed’s Breakouts”);

// ————— Controls for Chart Display ———————————-
SetChartOptions(0, chartShowDates | chartWrapTitle);
if (ParamToggle(“Tooltip shows”, “All Values|Only Prices”))
{
ToolTip = StrFormat(“Open: %g\nHigh: %g\nLow: %g\nClose: %g (%.1f%%) \nVolume: ” + NumToStr(V, 1), O, H, L, C, SelectedValue(ROC(C, 1)));
}

space = Param(“Space on Chart”, 20, – 15, 50, 1);
GraphXSpace = space;
SetChartBkColor(ParamColor(“Background Color”, colorBlack));

// ================= Rasheed’s original code (with Lookback and Shift default set to his specs) =================

H0 = H;
L0 = L;
C0 = C;
O0 = O;

Lookback = Param(“LookBack”, 10, 10, 50, 1); // Default for interday commodity currency trading
shift = Param(“Shift”, 5, 1, 50, 1); // ?
x0 = LastValue(Cum(1));
x1 = x0 – shift;
H = Ref(H, – shift + 1);
L = Ref(L, – shift + 1);
H1 = LastValue(Ref(HHV(H, Lookback), – 1));
L1 = LastValue(Ref(LLV(L, Lookback), – 1));

Plot(H1, “H1″, colorYellow);
Plot(L1, “L1″, colorYellow);

H = H0;
L = L0;
C = C0;
O = O0;

up = Cross(H, H1)AND Cum(1) > x1;
dn = Cross(L1, L)AND Cum(1) > x1;

Plot(C, “Close”, IIf(Cum(1) > x1 – Lookback AND Cum(1) <= x1, colorBlue, IIf(Up, colorBrightGreen, IIf(Dn, colorRed, IIf(C > O, colorGreen, colorRed)))), 64);
PlotShapes(shapeDownArrow *(Cum(1) == x1 + 1), colorBlue);

// ======================= Exploration and Signal Code =================
TRIGGER = ParamToggle(“Trigger “, “CLOSE|HIGH OR LOW”);

XH1 = Cross(C, H1);
XL1 = Cross(L1, C);
XH2 = Cross(H, H1);
XL2 = Cross(L1, L);

if (TRIGGER == 0)
{
Buy = XH1;
Sell = XL1;
}

else
{
Buy = XH2;
Sell = XL2;
}

TradeDisplay = ParamToggle(“Remove Extra Trades?”, “No|Yes”);

if(TradeDisplay != 0){
Buy = ExRem(Buy, Sell);
Sell = ExRem(Sell, Buy); // THIS WILL REMOVE EXESS SIGNALS ON A CHART OR IN AN EXPLORATION
}

Filter = Buy OR Sell;
Action = WriteIf(Buy, “BUY”, WriteIf(Sell, “SELL”, ” “));

AddTextColumn(IndustryID(1), “Industry Sector “, 30.0, colorBlue, colorYellow);
AddColumn(C, “Last “, 2.2, colorWhite, colorBlue);
AddTextColumn(Action, “Action”, 8.0, IIf(XH1, colorDarkGreen, colorDarkRed), colorWhite);
AddColumn(IIf(XH1, H1, L1), “BREAKOUT LEVEL”, 3.2, colorYellow, IIf(XH1, colorDarkGreen, colorDarkRed));

// ———————————————————————————– Arrow signals — FOR TRADES ———————————————————-
PlotShapes(Buy *shapeUpArrow, colorBrightGreen, 0, L /* ENTRY_TRAILARRAY */, – 30);
PlotShapes(Sell *shapeDownArrow, colorLightYellow, 0, H, – 30);
_SECTION_END();

_SECTION_BEGIN(“Volume At Price”);
PlotVAPOverlay(Param(“Lines”, 1000, 100, 1000, 10), Param(“Width”, 15, 1, 100, 1), ParamColor(“Color”, colorBlue), ParamToggle(“Side”, “Left|Right”, 1) | 4 *ParamToggle(“Z-order”, “On top|Behind”, 1));

_SECTION_END();

 AFL from Rasheed.

You are reading this article on analystcalls.in, Stay tuned for career, Education news, Jobs, Exam Results, Answer keys, Interviews & Job discussions, Stock Market Technical and Trading Analysis and Calls, Latest Trendy News! For regular updates like us on Facebook and Subscribe by Email to get immediate updates.

Enter your email address to get Instant Updates:

Do check your Inbox and Verify after submitting your Email

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

813 k