Architecture: Seven Helper Functions
This AFL is architected as a function library โ seven reusable helper functions (HAI_F1 through HAI_F7) that each handle a specific market condition check. This modular design makes it easy to combine conditions and customize your entry/exit rules.
| Function | Description | Returns |
|---|---|---|
HAI_F1(no) | HHV/LLV trailing channel โ dynamic S/R level | Price level (tsl) |
HAI_F2(no) | Cross of Close above the HAI_F1 channel | Buy signal (0/1) |
HAI_F3(no) | Cross of Close below the HAI_F1 channel | Sell signal (0/1) |
HAI_F4(no) | AMA2-based dynamic S/R state โ is price above/below dynamic level? | State (0 or 1) |
HAI_F5(no) | Detects if AMA2 state is unchanged (sideways confirmation) | Boolean |
HAI_F6(p,n,s,m) | Bullish directional filter: PDI > MDI AND MACD > Signal | Boolean |
HAI_F7(p,n,s,m) | Bearish directional filter: MDI > PDI AND Signal > MACD | Boolean |
How the Signals are Generated
The AFL combines outputs from multiple functions to build high-confidence signals:
Buy Condition
HAI_F2 (HHV breakout) triggers AND HAI_F6 confirms bullish direction (PDI > MDI AND MACD > Signal). Both conditions must be true simultaneously.
Sell Condition
HAI_F3 (LLV breakdown) triggers AND HAI_F7 confirms bearish direction (MDI > PDI AND Signal > MACD). Confluence of breakout + momentum.
Technical Specifications
Installation & Setup
Download & Copy
Save IntradayAFL.afl to your AmiBroker Formulas\Custom folder.
Apply to Chart
Insert โ Indicators โ find Intraday AFL. The system draws the trailing S/R staircase line and plots arrows at signal points.
Use Explorer for Scanning
For scanning multiple NSE stocks simultaneously, run in AmiBroker Explorer. Filter column will mark stocks with active buy/sell conditions.