Hello everyone,
I wrote this code from a strategy that seemed extremely effective on the pair “USD / JPY “.
The problem is that the backtest I had seen did not use the spread, and had been tested over the last few years, which anyway were profitable.
So I rewrote a backtest with adaptation in H1 c
harts and spread of 1.5 points.
As you can see, the strategy
– is profitable in recent years
– can be positive on every forex pair (with some improvements for each pair)
– requires no indicator
Actually, we take position only between 22H and 23H, depending on the distance from the range period : 18H – 22H (this period can change with other pairs)
// Graphes H1
// Paire recommandée : USD/JPY
Defparam cumulateorders = false
// Levier (max conseillé : 1.5)
LEVIER = 1
// Choix du réinvestissement des gains ou non
REINV = 0
IF REINV = 0 THEN
n = 1*levier
ENDIF
IF REINV = 1 THEN
Capital = 100000 + strategyprofit
n = (capital / 100000)*levier
IF n <1 THEN
n = 1 // Taille minimum : 1
ENDIF
ENDIF
// Bougie référence 18 à 22H
If time = 220000 THEN
amplitude = highest[4](high) - lowest[4](low)
amplitude = amplitude*0.4
ouverture = close
ENDIF
// ACHAT & VENTE entre 22H et 23H
IF time >= 220000 and time <= 230000 THEN
Buy n shares at ouverture - amplitude limit
Sellshort n shares at ouverture + amplitude limit
ENDIF
// STOP & OBJECTIF
SET STOP %LOSS 0.6
SET TARGET %PROFIT 1.2
// SORTIE
IF time = 100000 THEN
SELL AT MARKET
EXITSHORT AT MARKET
ENDIF