Pin bar detection

Pin bar detection

Hello,

This is just an easy but effective code, to detect pin bars.
“Shooting stars” = bearish pin bars

“Hammer” = bullish pin bars

I don’t consider the color of the candle, but the size of the wick.

Have a good trading !

I wrote this code in order to test a strategy.

This strategy fails, but not the indicator code.

 

Share this

Risk disclosure:

No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.

ProRealTime ITF files and other attachments : How to import ITF files into ProRealTime platform?

PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials

  1. Adolfo Onrubia • 04/27/2016 #

    Thanks Doctrading! Let’s try something with it. 🙂

  2. Doctrading • 04/27/2016 #

    Sure, I will 🙂

  3. farridin • 04/27/2016 #

    Hi Doctrading thank you very much for this code. One question as I’m new to coding, what would be to size of the wick compared to body size for these pinbars? also is there any upper or lower shadows? is there a way to code shaven heads? thanks 

  4. Degardin Arnaud • 04/27/2016 #

    Many thanks for this indi! Good results on SPA35 con Timeframe 130min, I only modify this “(high – low) > 3* abs(close – open)”

    //————————————————————————-
    // Codice principale : PIN v1
    //————————————————————————-
    // Definizione dei parametri del codice
    DEFPARAM CumulateOrders = False // Posizioni cumulate disattivate

    PIN = CALL “PIN”

    TOSELL= (PIN=-1)

    TOBUY= (PIN=1)

    IF TOSELL THEN
    SELLSHORT 0.2 CONTRACT AT MARKET
    ENDIF

    IF TOBUY THEN
    BUY 0.2 CONTRACT AT MARKET
    ENDIF
    IF LONGONMARKET AND BARINDEX-TRADEINDEX(1) >= 20 THEN
    SELL AT MARKET
    ENDIF

    IF SHORTONMARKET AND BARINDEX-TRADEINDEX(1) >= 20 THEN
    BUY AT MARKET
    ENDIF

    //————————————————————————-
    // Funzione : PIN
    //————————————————————————-
    shootingstar = 0

    p = 5
    dev = 2

    BollInf = Average[p](close)-dev*std[p](close)
    BollSup = Average[p](close)+dev*std[p](close)

    IF (high – low) > 3* abs(close – open) THEN // définition d’une pin bar (étoile filante ou marteau)

    IF high>BollSup AND ((open – low) < 0.3*(high – low) OR (close – low) < 0.3*(high-low)) THEN
    shootingstar = -1
    ENDIF
    IF low<BollInf AND ((high – open) < 0.3*(high – low) OR (high – close) < 0.3*(high-low)) THEN
    shootingstar = 1
    ENDIF
    ENDIF

    return shootingstar as "Shooting Star"

  5. komiko • 04/27/2016 #

    9a marche pas ? le code sur prorealtime “erreur de syntaxe l’instruction retur et autorisée que dans le cadre de la création d’indicateurs”

    • Nicolas • 04/27/2016 #

      En effet, il s’agit bien du code d’un indicateur et non d’un screener ou d’une stratégie de trading. Il faut donc copier/coller le code dans le bon éditeur de code ou alors tout simplement télécharger le fichier .itf sur cette page et l’importer.

  6. RussJ • 04/27/2016 #

    Hey people

    Some great screeners on here but I’m pulling up too many stocks when I search.

    If I want to add to the code search for stocks that are $100 minimum in price then how would I do this?

    What would be the code?

    Thanks

    R

avatar
Register or

Likes

avatar avatar avatar avatar avatar avatar
Related users ' posts
Emil
2 years ago
Nicolas
2 years ago
5 main forex pairs average
5 main forex pairs average
4
Calculated instruments
Nicolas It's only compatible from PRT v12. With the "Calculated instruments" tool, you can know crea...
MaoRai54 many thanks. IG doesn't know when they'll release it :(
MaoRai54 Hi Nicolas, I'm here again. Today I got the v.12 in my demo account. I started it, I downlo...
Jiacky
2 years ago
Range Factor
Range Factor
0
Indicators
Stephane0174 Bonjour et merci pour le Screener. Je suis nouveau ici et je ne connais rien en programmati...
Nicolas Je pense que c'est le copier/coller des guillemets qui pose problème, il faudrait les retape...
smp I also have an End Of Day (EOD) cash pivot indicator for use on cash markets; this indicator...
bobanteo Hi Cristofer, thanks for sharing. Would it be possible to delete the confirmation candle af...
Dom Hello, hello....je commence le trading et découvre par la même occasion le codage....et ce n...
Nicolas Merci, ça fait plaisir !
Be-n Bonjour tout le monde ! Dans l'indicateur de tendance, j'ai du mal à saisir la nuance entre ...
Theo D'accord merci
tobytarczy Hi, I have been looking for something like this. I have a f questions about the indicator. ...
tobytarczy Hi have been trying to modify the code you so kindly shared to reflect to the image you have...
Pablo Carmona del Moral hola juanjo, muchas gracias por este screener que nos has compartido. creo que lo voy a util...
Pablo Carmona del Moral para el volumen he cambiado: // Volumen significativo VS=volume>2*(average[10](volume[1...
Juanjo Muchas Gracias Pablo, ...Tengo varios screener, uno lo tengo adaptado para operar intradía, ...
Maik2404 es sind leider nur long Positionen und keine Short zu erkennen.
Maik2404 Vytautas: es bleibt aber nur bei long Auslösungen
ullle73 this one is not a winner, have backtested it on almost all pairs, does not have an edge
Leo Does it opens pending orders?... maybe they were not trigger.
Mattzi Dont know, all i can see is that it opened an order yesterday in backtest but not live. Th...
Jean-Christophe Hello Leo, when running the strategy from 29/12/2015 to 31/08/2018 on ProRealTime Premium, I...
Nicolas Please add a request on forums for any MT4 code conversion, thank you. Follow these easy ste...
mecon I will do so, thank you!
avatar
Anonymous @mecon, did you ever get one?
apachx Hi. Please, describe the algorithm in words. I want to understand how it works, but for now...
777dks hi this doesnot seem to work on forex, any ideas? thanks.
Doctrading Hello, Higher timeframes are better. I suggest D1 or H4.Best regards,
Pinkybouh hello, I propose to add another conditions: ie: haussier: close > open and close >...
TheHovisTrader I'd be interested in the actual profit of this - in the example the stop range is at least 2...
Nicolas Hi, there's no reason why it should not work on a 5 min chart. Just apply the indicator on y...
Percygreen77 good evening sorry for my english but the indicator don't work can you help me i have 10.3 v...
Nicolas By adding it on price, it should display the pattern detection on the price chart, and not ...
Dimi.A Awesome mate.
mora87 Hi David and Nicola, I'd like to share idea with you guys which is related to David's Idea. ...
Nicolas Please ask for custom coding in forums instead.
Naren Yanan what is    diplus  diminus  please
Barney Has anyone tested this algon now when PRT 10.3 was released?
Yngve does anyone know if the issue with the TP/SL is resolved ?

Top