Bonjour à tous,
//Source idea: https://www.whselfinvest.nl/nl-nl/trading-platform/gratis-trading-strategie/tradingsysteem/17-ichimoku-tkc
Defparam CumulateOrders = false // Cumulating positions deactivated
//Defparam flatafter = 164500
//VARIABLES
once StartE = 010000 //start time for opening positions
once StartL = 230000 //ending time for opening positions (only trading in the morning)
once N = 1 // initieel aantal contracten
OTD = Barindex - TradeIndex(5) > IntradayBarIndex // limits the (opening) trades till 1 per day
once Spread = 1 //total spread buy and sell, the actual price is always in between !
once SL = round(close * 100/10000) //Setting Stop loss //Dynamic for indices
// Ichimoku settings
TenkanSen = (highest[S](high)+lowest[S](low))/2 // default setting S = 9
KijunSen = (highest[M](high)+lowest[M](low))/2 // default setting M = 26
SenkouSpanA = (Tenkansen[M]+Kijunsen[M])/2 // default setting M = 26
SenkouSpanB = (highest[L](High[M])+lowest[L](Low[M]))/2 //default setting L = 52
// Closing methodes (described for long positions, for short positions exactly the opposite
//Method 1 if TenkanSen crosses under the Kijunsen
//Method 2 if close closes under the upper side of the Kumo / Cloud, based upon the SenkouSpanA
//Method 3 if close closes under the lower side of the Kumo / Cloud, based upon the SenkouSpanB
ClosingMethod = cm //default is cm = 1
//Open LONG BUY conditions (2):
// 1: Tenkan Sen crosses over the Kijun Sen AND
// 2: Close is within 4 periods after the crossing above the Kumo (cloud), defined as Max(SenkouSpanA, SenkouSpanB) /
//Open SHORT SELL conditions (2):
// 1: Tenkan Sen crosses under the Kijun Sen AND
// 2: Close is within 4 periods after the crossing BELOW the Kumo (cloud), defined as Min(SenkouSpanA, SenkouSpanB) /
KumoBorderLong = Max(SenkouSpanA, SenkouSpanB) //
KumoBorderShort = Min(SenkouSpanA, SenkouSpanB) //
//graph KumoBorderShort
If TenkanSen crosses over KijunSen then // base for counting bars when crossing takes place
CondLong = 1
else
CondLong = 0
endif
If TenkanSen crosses under KijunSen then
CondShort = 1
else
CondShort = 0
endif
//graph cond1L
if time >= StartE And time <= StartL and OTD and not onmarket then
IF summation[4](CondLong) = 1 and summation[4](CondShort) = 0 and Close > KumoBorderLong then //
BUY N shares AT MARKET
SET STOP ploss SL
endif
IF summation[4](CondLong) = 0 and summation[4](CondShort) = 1 and Close < KumoBorderShort THEN //
SELLSHORT N shares AT MARKET //short sell conditie
SET STOP pLOSS SL
endif
endif // end purchase conditions
if not onmarket then
PriceExit = 0
endif
if longonmarket then // 3 Exit strategies
if ClosingMethod = 1 then
If TenkanSen crosses under KijunSen then
sell at market
endif
endif
if ClosingMethod = 2 then
if close - Spread * 0.5 < KumoBorderShort then //to secure a possible stop for Sell at market
PriceExit = close - Spread * 0.5
else
PriceExit = KumoBorderShort // regular STOP for sell at market, set for each trading bar
endif
endif
if ClosingMethod = 3 then
if close - Spread * 0.5 < KumoBorderLong then //to secure a possible stop for Sell at market
PriceExit = close - Spread * 0.5
else
PriceExit = KumoBorderShort // regular STOP for sell at market, set for each trading bar
endif
endif
endif
if shortonmarket then //// 3 Exit strategies
if ClosingMethod = 1 then
If TenkanSen crosses over KijunSen then
exitshort at market
endif
endif
if ClosingMethod = 2 then
if close + Spread * 0.5 > KumoBorderLong then //to secure a possible stop for Sell at market
PriceExit = close + Spread * 0.5
else
PriceExit = KumoBorderLong // regular STOP for EXIT SHORT at market, set for each trading bar
endif
endif
if ClosingMethod = 3 then
if close + Spread * 0.5 > KumoBorderShort then //to secure a possible stop for Sell at market
PriceExit = close + Spread * 0.5
else
PriceExit = KumoBorderShort // regular STOP for EXIT SHORT at market, set for each trading bar
endif
endif
endif
//exit on trailing stop price levels
if onmarket and priceexit>0 then //price exit set for each trading bar
EXITSHORT AT priceexit STOP
SELL AT priceexit STOP
endif
//graph priceexit
Je testais ce code et au moment de l’activer ProOrder m’indique “Remplacez les variables par des valeurs fixes” (page initiale du code : https://www.prorealcode.com/prorealtime-trading-strategies/an-ichimoku-strategy/)
Quelles sont les valeurs qui doivent être remplacées (je suis très novice en la matière ^^)
Merci de votre aide.
Je crois comprendre que c’est par là que cela se passe (voir PJ). Après je suis preneur d’info pour savoir quoi faire 🙂 Je bloque. Merci d’avance.
En effet, l’auteur a introduit des variables à optimiser pour ses backtests. Mais pour passer en réel, ProOrder doit bien entendu quelles sont les valeurs à utiliser pour calculer les indicateurs. Toutes ces valeurs de variables doivent donc être fixes, à lecture du code, il s’agit des variables S,L et M (paramètres de l’ichimoku) et la variable “cm”, soit le mode d’entrée selon l’auteur, tout est décrit dans le code ! 😉
Bonjour Nicolas,
Si je comprends bien la saisie attendu est une des 4 suivantes :
Once ClosingMethod = cm (ou S/ ou M/ ou L à la place de cm suivant le choix de chacun) ? Cette écriture est correcte ?
Merci de ton aide,
Oui il faut remplacer ces lettres par des valeurs en chiffres, celles que tu auras choisi pour lancer l’algorithme de trading en réel.
Bon, je n’y arrive pas …
J’ai essayé
once ClosingMethod = [1]
once ClosingMethod = [1;3][1]
once ClosingMethod = cm=[1]
Marche pas … je galère je sais pas comment faire
Re, bon je crois que j’avance 😀
J’ai mis un peu au hasard ces valeurs :
S =7
M = 14
L = 55
cm = 1
// Ichimoku settings
TenkanSen = (highest[S](high)+lowest[S](low))/2 // default setting S = 9
KijunSen = (highest[M](high)+lowest[M](low))/2 // default setting M = 26
SenkouSpanA = (Tenkansen[M]+Kijunsen[M])/2 // default setting M = 26
SenkouSpanB = (highest[L](High[M])+lowest[L](Low[M]))/2 //default setting L = 52
// Closing methodes (described for long positions, for short positions exactly the opposite
//Method 1 if TenkanSen crosses under the Kijunsen
//Method 2 if close closes under the upper side of the Kumo / Cloud, based upon the SenkouSpanA
//Method 3 if close closes under the lower side of the Kumo / Cloud, based upon the SenkouSpanB
once ClosingMethod = cm //default is cm = 1
Ca a l’air de se lancer. Mais du coup à quoi servent les valeurs M S et L ? 🙂
bonjour,
tu utilise qu’elle version de PRT ?
ci joint ichimoku avec les bonnes valeur
// ichimoku
Tenkan = (highest[9](high)+lowest[9](low))/2
Kijun = (highest[26](high)+lowest[26](low))/2
SSpanA = (tenkan[26]+kijun[26])/2
SSpanB = (highest[52](high[26])+lowest[52](low[26]))/2
FutureSpanA = (tenkan+kijun)/2
FutureSpanB = (highest[52](high)+lowest[52](low))/2
Merci 🙂 Sais tu à quoi correspondent les valeurs S / M / L dans le code ?
A ces valeurs mêmes mais codées différemment ?
tu peux remplacer les chiffres par des lettres et donnée plus haut des valeurs a tes lettres
Ces valeurs sont celles issues de l’optimisation, donc tu indiques celles que tu veux, ces lettres auraient pu être des mots comme tata, tonton, ou toto, peu importe.
Je suis depuis quelques jours en train de découvrir tout ca, j’ai réussi à faire fonctionner et différents test. je vous remercie de votre aide.
Bonjour,
je profite des réponses ci-dessus pour poser une question en rapport avec les variables optimisées; si je dois écrire par exemple (i compris entre 0 et 9) comment je pourrai l’écrire ?
Merci;
Vital