Doctrading

A "harami" trading strategy code for Daily EUR/USD

Category: Strategies By: Doctrading Created: April 13, 2016, 4:32 PM
April 13, 2016, 4:32 PM
Strategies
7 Comments
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.

WARNING :

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[50](close)

REM Définition du Harami
c1= high[0] < high[1]
c2= low[0] > low[1]
harami = c1 and c2


// Prise de position
IF harami and close > MM50 and close < open THEN
 buy n shares at market nextbaropen
ENDIF

IF harami and close < MM50 and close > open THEN
 sellshort n shares at market nextbaropen
ENDIF

// Clôture
IF barindex - tradeindex = 1 THEN
 sell at market 
 exitshort at market
ENDIF

 

Download
Filename: CODE-HARAMI.itf
Downloads: 404
Doctrading
Doctrading Master
Hello, I'm Marc. Nice to meet you.
Author’s Profile

Comments

Doctrading
10 years ago
#

Hello,

Yes, there is a command I think, but I don't know it. Nicolas knows it.

You can also use less leverage.
Best regards,

Duccio
10 years ago
#

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

Doctrading
10 years ago
#

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

Doctrading
10 years ago
#

It depends of your broker.

Or you can use the command "dayofweek"

gutta11
10 years ago
#

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

Doctrading
11 years ago
#

Hello,

Strange.

Use it on EUR/USD, with NO CANDLE on Sunday.

I use prorealtime.com (free daily data).

gutta11
11 years ago
#

Hi!

Why do I get a result which is -92% and only one trade in daily?

What do you think is wrong?

ProRealCode ProRealCode
Loading...