PIN Bar detector – Amibroker AFL code

Pin Bar Detector – (Amibroker Indicator) is pin bar pattern detection system inspired for Earnforex – Pin Bar Detecor mql4 code. Pin Bar is a bar with a long upper or lower “tail”, “wick” or “shadow” and a much smaller “body” or “real body”, you can find pin bars on any plain candlestick chart. The Pinbar (also known as “Pin-bar” or “Pin bar”) pattern was first introduced by Martin Pring in his Pring on Price Patterns.


It is a pure price action based indicator and in this indicator marks the bullish pin bar and bearish pin bar on the charts and also one scan use the exploration to find out the pin bar patterns from the list of stocks.

Recommended Timeframe
Higher timeframes like Hourly, 4 hourly, Daily, Weekly timeframes


Bullish Reversal Pin Bar Formation

In a bullish pin bar reversal setup, the pin bar’s tail points down because it shows rejection of lower prices or a level of support. This setup very often leads to a rise in price.

Bearish Reversal Pin Bar Formation

In a bearish pin bar reversal setup, the pin bar’s tail points up because it shows rejection of higher prices or a level of resistance. This setup very often leads to a drop in price.

Pin Bar Patterns in Gold Daily Charts
Pin Bar Detector

Input Parameters for Pin Bar

MaxNoseBodySize (default = 0.33) — maximum allowed body/length ratio for the Nose bar.

NoseBodyPosition (default = 0.4) — Nose body should be position in top (bottom for bearish pattern) part of the Nose bar.

LeftEyeOppositeDirection (default = true) — tells the indicator that the Left Eye bar should be bearish for bullish Pinbar, and bullish for bearish Pinbar.

NoseSameDirection (default = true) — tells the indicator that the Nose bar should be of the same direction as the pattern itself.

NoseBodyInsideLeftEyeBody (default = false) — tells the indicator that the Nose body should be inside the Left Eye body.

LeftEyeMinBodySize (default = 0.1) — minimum size of the Left Eye body relative to the bar length.

NoseProtruding (default = 0.5) — minimum protrusion of the Nose bar relative to the bar length.

NoseBodyToLeftEyeBody (default = 1) — maximum size of the Nose body relative to the Left eye body.

NoseLengthToLeftEyeLength (default = 0) — minimum Nose length relative to the Left Eye length.

LeftEyeDepth (default = 0.2) — minimum depth of the Left Eye relative to its length. Depth is length of the part of the bar behind the Nose.

Note : This strategy doesnt detects a perfect pin bar however some manual intervention is necessary to spot pin bar patterns accurately

Steps to Install Pin Bar Detector Afl Code
1)Download PIN BAR Detector afl code
2)Unzip Pin Bar to local folder
3)Copy PIN Bar file to \program files\amibroker\formula\basic folder
5)Open Amibroker and Open a New Blank Chart
6)Goto Charts->Basic Charts and apply/drag-and-drop the Pin Bar detector code into the blank chart
7)Bingo you are done. Now you will be able to see the Pin Bar Detector indicator with Buy and Sell signals.

Pin Bar Trading System – Earnforex
Characteristic of Pin Bar formation – Learn to Trade the Market

Related Readings and Observations

  • Nifty Weekly Analysis for 13-17, July, 2009 Nifty closes below a fresh 4 week low. Nifty Weekly Resistance5 EMA-Low - 4105 - candle closed below 5EMA -Low on Weekly basis since March,2009 13 EMA - 4033 - Nifty closed below […]
  • No Updates till 16 Jan 2010 Hi Readers,I will be out of the city till 16th Jan 2010. Till then the blog wont be updated. But I will beconstantly monitoring the virtual portfolio and will try to update the views about […]
  • Nifty and Bank Nifty 90 min charts for 18 May 2012 Trading Nifty and Bank Nifty are in sell mode since 4th May. Currently the cloud resitance are coming near 4928 and 9340 repsectively. Positions should be reversed to longs only if the support […]
  • Site Maintenance : Blogger to WordPress Platform Migration Marketcalls is likely to migrate from Blogger to Self Hosted WordPress platform with lot of interactive functionalities. Site will be under maintenance mode during the migration […]


  1. sumit says

    thanks for the pin bar afl .

    i have selected 20 stocks in my favourite list.

    how to scan these 20 stocks in real time with pin bar afl in multi time frames. or in single time frame. and a popup notification shud be there even while i m writing mails .surfing etc .

    please also note that i keep only nifty chart open with 5 min tf open

    is it possible in amibroker. ?


    நாளை மார்க்கெட் நேரத்தில் பயன்படுத்தும் போதுதான் தெரியும் எப்படி இருக்கிறது என்று. நன்றாக இருக்கும் என்று நினைக்கிறேன். நன்றி ராஜேந்திரன் சார்.

    • says


      Its only for higher timeframes and mostly involved human subjective decision to identify the correct pin bar even though the system provides the information.

  3. vikram says

    Respected Rajandran R
    i am vikram patel from ahmedabad i am senior citizzen i have talked with you several times ago regarding swing high and swing low
    i have tried to contact lot of expert but they werw not able to prepare afl as per my calculation
    you are on top of experts of ami broker as you talked you do not have time and donot write afl for personal people
    i have one request to suggest name of expert who can prepare afl on swing high and swing low.
    as you mention that swing high and swing low of spider software is repainting ,even though it is useful to me please help me in this matter do not dissappointme
    vikram patel
    mobile no--9137741905


    Respected Rajandran R,

    I am a Commodity Trader last 5 years, now 2 years I am very disappointed about Commodity Market because can’t earn of this market. Now some days ago I think leave this market.

    Can you suggest me, what should I do and what is right market EQUITY & COMMODITY? Your PINBAR afl which market is suitable like stocks or commodity.

    I hope once I try with your PINBAR afl (position trading) but which market EQ & COM.


    Naveen Kumar Murthy

  5. Praveen says

    When I verified syntax in formula editor of Amibroker, I got syntax error at Ln:22, Col: 149; Error 16. Too many arguments.

    Please help.

Leave a Reply

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