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.
DEFPARAM CUMULATEORDERS = false
n = 15
MM50 = average(close)
REM Définition du Harami
c1= high < high
c2= low > low
harami = c1 and c2
// Prise de position
IF harami and close > MM50 and close < open THEN
buy n shares at market nextbaropen
IF harami and close < MM50 and close > open THEN
sellshort n shares at market nextbaropen
IF barindex - tradeindex = 1 THEN
sell at market
exitshort at market
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 :