A “harami” trading strategy code for Daily EUR/USD

A “harami” trading strategy code for Daily EUR/USD

I originally found this code on internet.

To go “long” : when meeting a Harami with a black (or red) candle above the 50 days moving average, we buy the next day at the opening.

We close days later, no matter what happens !

The procedure is the opposite for the “short” trades.

The strategy is profitable on EUR/USD.


The test exclude Sunday candles (included in Mondays).

If you view the candle of  Sunday (from 23H to 00H), then the test will be completely distorted !

This code is certainly not a panacea, but it deserves to be refined and improved, no doubt.


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?

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

  1. gutta11 • 04/13/2016 #

    Hi!Why do I get a result which is -92% and only one trade in daily?
    What do you think is wrong?

  2. Doctrading • 04/13/2016 #

    Use it on EUR/USD, with NO CANDLE on Sunday.
    I use prorealtime.com (free daily data).

  3. gutta11 • 04/13/2016 #

    Okey thank you. How do I set “NO CANDLE on Sunday” ?

  4. Doctrading • 04/13/2016 #

    It depends of your broker.
    Or you can use the command “dayofweek”

  5. Doctrading • 04/13/2016 #

    Maybe you can also change the hourly beginning of the day (not 23PM but 12AM, OOH in french). It must be possible.

  6. Duccio • 04/13/2016 #

    Hi Doctrading,there is a way to control the max loss of the positions in this code?
    For example, if I wanted that the positions do not lose more than 200 euro what kind of code I cat try?
    Thank you

  7. Doctrading • 04/13/2016 #

    Yes, there is a command I think, but I don’t know it. Nicolas knows it.
    You can also use less leverage.Best regards,

Register or


avatar avatar avatar
Related users ' posts
Theo Salut, qu'elle est ta définition de niveau institutionnel et comment les trouves tu?
Etops Hello, les niveaux sur lesquels il y a des réactions fortes de la part des banques, les nive...
Matriciel Yes indeed. You have to test this strategy in demo mode for a while before launching it in ...
agamennone m hi,i'm new about this,somebody can explain me how does this strategy works? thanks
luigiR hi, can you explane how to try to launch with pro order? good job
juanj DId some tests using MACD validations on higher timeframes using MTF functionality and unfor...
FREDNC Hi Francesco I tried with :
FREDNC adx[14]>adxmin and adx[14] > adxr[14] and adx[14]>adxmin and adx[14] DIminus[3](clo...
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!
firemyst @mecon, did you ever get one?
apachx Hi. Please, describe the algorithm in words. I want to understand how it works, but for now...
ALE Hello Paul, please visit my website : www.automatictrading.it Thanks Ale
Michaldst Hi! thanks for sharing! Could you tell something about TP and SL conditions?
cryptotips tips Its horrible !!
4example excellent, thank you
Wilko In answer to SAM: The Logic of the cover clause containing the same logic as the entry-claus...
JanWd Tried the code, nice concept, seems to work quit well for US/EUR 2hrs, Other markets seems n...
JR1976 Simple and nice code , congrats !!! Seems work well with TIme frame 1 h
juanj The last fractal will be coordinate 1 and the high/low of the candle that generates an angle...
juanj And the point of violation is the close of the candle that violates the line by generating a...
juanj For the latest version of the strategy or to follow updates and developments see the thread ...
poonsl2828 Hi! Francesco I have test it on GBP/USD but it only have a trade on 9 Jun which i backtes...
ullle73 why not use 1h chart? has 95% hitrate
ullle73 i see most of positions are only 1 pip before exit?
imokdesign Hi Everybody, when I look at the strategy I felt the need to implement a Moneymanagement-Sy...
Inertia newlevel then multiplier=multiplier+1 oldlevel=newlevel newlevel=strategyprofit+startequi...
Inertia Hi Bjoern, I was playing around with your code this morning (EUR/USD 5'). Thank you to the...
victormork Hi, I would just like to share my own take on this strategy. I'm using 30 min on EURUSD but ...
mckubik Thanks. I will run a Test. 
poonsl2828 Hi! bjoern May i know what timing should i change for time zone (Singapore (GMT +8:00) ...
Kris75 @Ale Hi Ale, Thanks for this rocking algo ;-) there is though a counter performance in 201...
Kris75 Sorry here is my question: >> how can we explain this and correct it?
Samitha Prasanna Hi ALE, would you be able to provide the values for the below part of the code (time >=1...
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...
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 ?
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.