Je m’intéresse depuis quelques jours à cet indicateur donné dans la bibliothèque ici et nommé B-XTrender. Cet indicateur a été produit par Bharat Jhunjhunwala et publié dans IFTA journal ( ifta.org/public/files/journal/d_ifta_journal_19.pdf ). Une adaptation en a été proposée par Nicolas. J’ignore si quelqu’un a déjà essayé et proposé un système basé sur cet indicateur mais l’auteur, lui, dans le même article en propose un. J’ai tenté une traduction en PRT langage et je vous la soumets ci-dessous :
// B-XTrender System
DEFPARAM CUMULATEORDERS = false
//DEFPARAM FLATBEFORE = 090000
//DEFPARAM FLATAFTER = 213000
//stpLossPIP = 40
//TgtprofitPIP = 2 * stpLossPIP
//SET STOP pLOSS stpLossPIP
//SET TARGET PPROFIT TgtprofitPIP
// Forex EUR/USD en 5 minutes
nbLots = 1 // 100000
Once nbrePosJourMax = 2
// reset de variables en début de journée
IF IntradayBarIndex = 0 THEN
nbreAppelsPos = 0
condTradeJour = 1 // booléen
endif
// vérification du nbre de positions ouvertes
if nbreAppelsPos < nbrePosJourMax then
condTradeJour = 1
else
condTradeJour = 0
endif
// — settings
shortl1 = 5 //Short – L1
shortl2 = 20 //Short – L2
shortl3 = 15 //Short – L3
longl1 = 20 //Long – L1
longl2 = 15 //Long – L2
// — end of settings
///////////////////////////////////////////////////////////////
// stratégie
shortTerm = rsi[shortl3](average[shortl1,1]-average[shortl2,1])-50
longTerm = rsi[longl2](average[longl1,1])-50
PosChangeInLongTerm = (longTerm[-1] < 0 and longTerm > 0)
NegChangeInLongTerm = (longTerm[-1] > 0 and longTerm < 0)
PosChangeInShortTerm = (shortTerm[-1] < 0 and shortTerm > 0)
NegChangeInShortTerm = (shortTerm[-1] > 0 and shortTerm < 0)
ChangeInLongTerm = PosChangeInLongTerm OR NegChangeInLongTerm
ChangeInShortTerm = PosChangeInShortTerm OR NegChangeInShortTerm
InitialBuy = PosChangeInLongTerm
InitialSell = NegChangeInLongTerm
Achat = InitialBuy or ((longTerm > 0) and PosChangeInShortTerm)
Vente = (longTerm > 0) and NegChangeInShortTerm
Short = InitialSell or ((longTerm < 0)) and NegChangeInShortTerm
ExShort = (longTerm < 0) and PosChangeInShortTerm
//////////////////////////////////////////////////////////////
// Prises de Positions
IF Achat and condTradeJour THEN
nbreAppelsPos = nbreAppelsPos + 1
BUY nbLots CONTRACTS AT MARKET
ENDIF
If LongOnMarket AND Vente THEN
SELL nbLots CONTRACTS AT MARKET
ENDIF
IF Short and condTradeJour THEN
nbreAppelsPos = nbreAppelsPos + 1
SELLSHORT nbLots CONTRACTS AT MARKET
ENDIF
IF ShortOnMarket AND ExShort THEN
EXITSHORT nbLots CONTRACTS AT MARKET
ENDIF
//////////////////////////////////////////////////////////////
(désolé mais je n’ai toujours pas compris comment on peut insérer proprement des lignes de programme dans ce forum)
Je pense avoir traduit correctement ce programme mais, en fait, je n’en suis pas certain pour la bonne raison qu’il refuse de prendre une quelconque position !
Si donc, quelqu’un pouvait m’aidait à sortir de mon impasse je lui en serai reconnaissant.
Bon après-midi à tous,
Gabriel