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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
shootingstar = 0 hammer = 0 IF (high - low) > 2* abs(close - open) THEN // définition d’une pin bar (étoile filante ou marteau) IF (open - low) < 0.3*(high - low) OR (close - low) < 0.3*(high-low) THEN shootingstar = -1 ENDIF IF (high - open) < 0.3*(high - low) OR (high - close) < 0.3*(high-low) THEN hammer = 1 ENDIF ENDIF return shootingstar as "Shooting Star", hammer as "Hammer" |
Share this
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 :PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials
Thanks Doctrading! Let’s try something with it. 🙂
Sure, I will 🙂
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
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"
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”
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.
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