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
JakeDB Answered my own question....Sorry about this question. 5 positions, take profit at 15, loss ...
maxxb sto facendo girare in demo questa strategia modificata a 10 minuti con stop e profit ottimiz...
Manuel9z Hello, this strategy improves with the SL 30 and the TP 10. I have done backtesting and it w...
Doctrading Hello, As I said, I didn't use spread for the screenshot as I don't trade Gold and I don't ...
smurfy Hi, I had been losing on gold and after I manually go through the 5min chart using IG and w...
eiffel Hi Smurfy, hope you are still there... I would like to help you to write and test the code.
Manu L. Et si je prends éventuellement celui-ci, comment puis je programmer le screener pour qu'il ...
Nicolas Pour des demandes personnalisées, merci d'utiliser le forum, en ouvrant un nouveau sujet tou...
Manu L. c fait :-) https://www.prorealcode.com/topic/pro-screeners-trend-reversal-continuation-pa...
Wilko This code is the work of a simple genius! Profitability lies in simplicity and repetition.
Nicolas Good joke. FYI, you'll find many identified recurring patterns there: http://paststat.com G...
Yngve i added a MA as a filter, that improved the equity curve quit nice actually
Doctrading Hello,  The strategy should be improved, no doubt. But it was just one of my ideas, which h...
ALEALE Yes Nicolas is very difficult, macro economic data can destroy any work!!  
styrke depends which.. I personally think that it's much more easier to trade on XBTUSD, try to co...
raviesco Hello Nicolas, Thanks for the post. Do you have an updated version of this screener/indi...
GraHal Ooops got that excited I sent that last one twice! ha (and can't delete it, sorry) I got it...
Eric n = 3  dont forget to allow 3 contract in proorder
UkCoopDownUnder Tried EURUSD GMT and GMT -1, as far back as I can go, Nov 2018 on 15mn Tf, 22% loss
Doctrading Hello, Someone asked me something (his results seemed to be different) on my email, but it ...
Glen Marquis Not your best..So what is your best strategy? :)
Benjamin Costa Ok thank you for your answers. Gianpiero, i have an Interactive brokers account. Noisette, i...
oldup It works on ProOrder - but  I don't like the maxWin = MaxLoss.    
oldup Just divise StopLoss /2 - Result is better  
Doctrading Bonjour, Tu as raison, il faut faire attention à la fiabilité de certains backtests. Le pro...
Duccio Hi DocTrading, I've backtested your strategy and I notice that 75% of position have been cl...
Doctrading Hello,  No, I don't use this strategy on real account, because my own strategies (that you ...
Doctrading Defparam cumulateorders = false n=1 // Plus le "ratio" monte, moins il y a de positions ...
Malloc Bonjour :) Je sais que cette stratégie a été partagée il y a de ça plusieurs années mais ...
lilo789 Hi guys! Do you know if it is possible to set the buy size to a relative % of the available...
luigiR Hallo doc, thank again for your strategy but can you suggest me  an example of the optimizat...
Wilko Do NOT take this system live! The backtest results will never be repeated live due to a shor...
mrripley99 So I've played around with this just recently and have achieved some good results in an IG d...
Doctrading Maybe you can also change the hourly beginning of the day (not 23PM but 12AM, OOH in french)...
Duccio Hi Doctrading,there is a way to control the max loss of the positions in this code? For exa...
Doctrading Hello, Yes, there is a command I think, but I don't know it. Nicolas knows it. You can als...
Pierreee That a realy great strategy !!!  It's realy profitable in daily trade. I'm gonna put some ...
entony hello timeframe on what works best and how couples ??grazie
111111dw i am running this on the cac 5m time frame but the results are very different from the backt...
Doctrading Hello fesxeurex, It can display both : when it is in formation, and when it has been formed...
the_giorgio Bonjour Doc, Je crois que votre définition du harami est erronée Critères du Harami D...
dfl3tch3r Great screener...Has anyone got code for trade/backtest the next bar breakout (short or long...

Top