ProRealCode - Trading & Coding with ProRealTime™
Et, j’oubliais de répondre à l’invite de Nicolas, au delà des remerciements, je consacrerai du temps à éplucher sa proposition de codage pour le ‘early detection’ et ses résultats…
Après quelques recherches, l’article (en anglais, sorry !) à l’origine de la programmation de Nicolas est téléchargeable après incription (gratuite) sur : http://technical.traders.com/archive/volume-2014.asp?yr=2011#Apr (Identifying Cup Formations Early)
La lecture de l’article permet de mieux comprendre l’approche de la ‘semi-tasse’.
Bonjour Nicolas,
Pensez-vous pouvoir finir ce super screener et si oui avez-vous une idée de quand cela sera disponible ?
Merci d’avance ;
Je trouve ce code pas mal du tout !
Il donne de nombreuse possibilité de formation de tasse avec hanse sur le plan visuel.
Mais il serai encore mieux si il pouvait les trier les valeurs avec un fort momentum ( tendance haussière) sur les 18 mois précédente la formation de la hanse.
Parameter = 2
C = close
FilC = ( log( C ) )
eps = 0.0000000001
for i = 1 to barindex do
if c[i]>c*parameter then
BarsSince=barindex-barindex[i]
break
endif
next
semicupperiod = Max( BarsSince, 1 ) + 1
Ptop = highest[Semicupperiod](FilC)
Pbot = lowest[Semicupperiod](FilC)
boxheight = abs( Ptop - Pbot ) / 5
boxlength = Max( round( semicupperiod / 5 ), 1 )
bar = max(1,barindex)
b0 = bar - semicupperiod + 1
b5 = bar
b1 = Min( b0 + boxlength, b5 )
b2 = Min( b1 + boxlength, b5 )
b3 = Min( b2 + boxlength, b5 )
b4 = Min( b3 + boxlength, b5 )
L2 = Pbot + 2 * boxheight
L3 = Pbot + 3 * boxheight
Diff = FilC - FilC[1]
UpSum2 = Summation[2*boxlength]( Max( Diff, 0 ) )
DnSum2 = Summation[2*boxlength]( Max( -Diff, 0 ) )
DSX1 = abs( UpSum2 - DnSum2 ) / ( eps + UpSum2 + DnSum2 ) * 100
UpSum3 = Summation[3*boxlength]( Max( Diff, 0 ) )
DnSum3 = Summation[3*boxlength]( Max( -Diff, 0 ) )
DSX2 = abs( UpSum3 - DnSum3 ) / ( eps + UpSum3 + DnSum3 ) * 100
if(bar>b2) then
test1=summation[bar-b2](FilC>L3)=0
endif
if(bar>b4) then
test2=summation[bar-b4](FilC>L2)=0
endif
isSemicup = ( semicupperiod >= 20 ) AND ( DSX1[ b5 - b2] > 25 ) AND ( DSX2 < 25 ) AND test1 and test2
LIS = isSemicup
screener[lis]
ayant très peu de notion en programmation est ce que quelqu’un pourrai m’aider a aboutir mon idée ?
Merci d’avance
Je trouve ce code pas mal du tout !
Il donne de nombreuse possibilité de formation de tasse avec hanse sur le plan visuel.
Mais il serai encore mieux si il pouvait les trier les valeurs avec un fort momentum ( tendance haussière) sur les 18 mois précédente la formation de la hanse.
Formation tasse
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 Parameter = 2C = closeFilC = ( log( C ) )eps = 0.0000000001for i = 1 to barindex doif c[i]>c*parameter thenBarsSince=barindex–barindex[i]breakendifnextsemicupperiod = Max( BarsSince, 1 ) + 1Ptop = highest[Semicupperiod](FilC)Pbot = lowest[Semicupperiod](FilC)boxheight = abs( Ptop – Pbot ) / 5boxlength = Max( round( semicupperiod / 5 ), 1 )bar = max(1,barindex)b0 = bar – semicupperiod + 1b5 = barb1 = Min( b0 + boxlength, b5 )b2 = Min( b1 + boxlength, b5 )b3 = Min( b2 + boxlength, b5 )b4 = Min( b3 + boxlength, b5 )L2 = Pbot + 2 * boxheightL3 = Pbot + 3 * boxheightDiff = FilC – FilC[1]UpSum2 = Summation[2*boxlength]( Max( Diff, 0 ) )DnSum2 = Summation[2*boxlength]( Max( –Diff, 0 ) )DSX1 = abs( UpSum2 – DnSum2 ) / ( eps + UpSum2 + DnSum2 ) * 100UpSum3 = Summation[3*boxlength]( Max( Diff, 0 ) )DnSum3 = Summation[3*boxlength]( Max( –Diff, 0 ) )DSX2 = abs( UpSum3 – DnSum3 ) / ( eps + UpSum3 + DnSum3 ) * 100if(bar>b2) thentest1=summation[bar–b2](FilC>L3)=0endifif(bar>b4) thentest2=summation[bar–b4](FilC>L2)=0endifisSemicup = ( semicupperiod >= 20 ) AND ( DSX1[ b5 – b2] > 25 ) AND ( DSX2 < 25 ) AND test1 and test2LIS = isSemicupscreener[lis]ayant très peu de notion en programmation est ce que quelqu’un pourrai m’aider a aboutir mon idée ?
Merci d’avance
Je trouve ce code pas mal du tout !
Il donne de nombreuse possibilité de formation de tasse avec hanse sur le plan visuel.
Mais il serai encore mieux si il pouvait les trier les valeurs avec un fort momentum ( tendance haussière) sur les 18 mois précédente la formation de la hanse.
Formation tasse
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 Parameter = 2C = closeFilC = ( log( C ) )eps = 0.0000000001for i = 1 to barindex doif c[i]>c*parameter thenBarsSince=barindex–barindex[i]breakendifnextsemicupperiod = Max( BarsSince, 1 ) + 1Ptop = highest[Semicupperiod](FilC)Pbot = lowest[Semicupperiod](FilC)boxheight = abs( Ptop – Pbot ) / 5boxlength = Max( round( semicupperiod / 5 ), 1 )bar = max(1,barindex)b0 = bar – semicupperiod + 1b5 = barb1 = Min( b0 + boxlength, b5 )b2 = Min( b1 + boxlength, b5 )b3 = Min( b2 + boxlength, b5 )b4 = Min( b3 + boxlength, b5 )L2 = Pbot + 2 * boxheightL3 = Pbot + 3 * boxheightDiff = FilC – FilC[1]UpSum2 = Summation[2*boxlength]( Max( Diff, 0 ) )DnSum2 = Summation[2*boxlength]( Max( –Diff, 0 ) )DSX1 = abs( UpSum2 – DnSum2 ) / ( eps + UpSum2 + DnSum2 ) * 100UpSum3 = Summation[3*boxlength]( Max( Diff, 0 ) )DnSum3 = Summation[3*boxlength]( Max( –Diff, 0 ) )DSX2 = abs( UpSum3 – DnSum3 ) / ( eps + UpSum3 + DnSum3 ) * 100if(bar>b2) thentest1=summation[bar–b2](FilC>L3)=0endifif(bar>b4) thentest2=summation[bar–b4](FilC>L2)=0endifisSemicup = ( semicupperiod >= 20 ) AND ( DSX1[ b5 – b2] > 25 ) AND ( DSX2 < 25 ) AND test1 and test2LIS = isSemicupscreener[lis]ayant très peu de notion en programmation est ce que quelqu’un pourrai m’aider a aboutir mon idée ?
Merci d’avance
J’ai rajouté ceci au code, c1 = 2 MM 50 et 20 avec 20 sup a 50
c2 compression du prix a 10 % a la anse ( a la anse peut être)
Pas d’erreurs de syntaxe mais aucun résultat,surement normale vu la rareté des figures?
mm50 = average[50] (close) mm20 = average[20] (close) c1 = summation[70](mm20>mm50)=70 Parameter = 2 C = close FilC = ( log( C ) ) eps = 0.0000000001 for i = 1 to barindex do if c[i]>c*parameter then BarsSince=barindex-barindex[i] break endif next semicupperiod = Max( BarsSince, 1 ) + 1 Ptop = highest[Semicupperiod](FilC) Pbot = lowest[Semicupperiod](FilC) boxheight = abs( Ptop - Pbot ) / 5 boxlength = Max( round( semicupperiod / 5 ), 1 ) bar = max(1,barindex) b0 = bar - semicupperiod + 1 b5 = bar b1 = Min( b0 + boxlength, b5 ) b2 = Min( b1 + boxlength, b5 ) b3 = Min( b2 + boxlength, b5 ) b4 = Min( b3 + boxlength, b5 ) L2 = Pbot + 2 * boxheight L3 = Pbot + 3 * boxheight Diff = FilC - FilC[1] UpSum2 = Summation[2*boxlength]( Max( Diff, 0 ) ) DnSum2 = Summation[2*boxlength]( Max( -Diff, 0 ) ) DSX1 = abs( UpSum2 - DnSum2 ) / ( eps + UpSum2 + DnSum2 ) * 100 UpSum3 = Summation[3*boxlength]( Max( Diff, 0 ) ) DnSum3 = Summation[3*boxlength]( Max( -Diff, 0 ) ) DSX2 = abs( UpSum3 - DnSum3 ) / ( eps + UpSum3 + DnSum3 ) * 100 if(bar>b2) then test1=summation[bar-b2](FilC>L3)=0 endif if(bar>b4) then test2=summation[bar-b4](FilC>L2)=0 endif isSemicup = ( semicupperiod >= 20 ) AND ( DSX1[ b5 - b2] > 25 ) AND ( DSX2 < 25 ) AND test1 and test2 LIS = isSemicup c2 = (highest [20] (high)-lowest[20](low))<=close*0.10 screener[lis and c1 and c2]Suis-je dans le vrai ?
Merci
Merci Mika pour cette contribution ; je la teste de ce pas ;
de mon côté j’ai trouvé au bout de la nuit et au fin fond du web, ce code Amibroker qu’il nous faudrait “PRTiser” ;
On y est presque !!
Merci encore Nicolas pour votre aide ;
_SECTION_BEGIN("Cup and Handle exploration");
// Cup and Handle exploration written by Jerry Tyliczka
// visit us at: http://portals.wallstreettape.com
//
// This code written per specifications found at
// http://www.haikulabs.com/mh.htm
// Version 1.0
//
// This code calculates the Alpha, Delta, Beta and Gamma values
// but they are not used in the filter criteria as specified
// by the article which this code was based on.
//
// Look for additional changes as I tweak the below code.
// I will also include Scan feature and Backtesting in future release.
//
// Comments, please write to admin@wallstreettape.com
MinPrice=0.1;
MinVolume=10000;
//Left side of Handle formation can occur anywhere from 2-25days - look at the last 25 bars AND get the number of bars since condition met.
LH=HHV(Close,25); // Highest close past 25 days.
BLH=HHVBars(Close,25); // Tells us # of bars that have past since high reached. Used to determine Lowest bar.
BH=LLV(Close,BLH); // Lowest close since the highest value was reached/
BBH=LLVBars(Close,BLH); // number of bars that have past since lowest value.
NBLH=BLH-BBH; // this is the number of bars in the formation of the left side handle. NBLH must be atleast 2 to be a valid handle formation.
// Now lets get the cup formation. Cup formation can occur anywhere from 23 to 145 days. The left side of the cup can be from 20-120 days AND the right side can be anywhere from 3-25 days.
// get the right side of the cup(low).
BC=LLV(Close,BLH+25); // look at 25 bars since the left side of handle.
BBC=LLVBars(Close,BLH+25);
// get the left side of the cup.
LC=Ref(HHV(Close,120),BBC*-1);
BLC=Ref(HHVBars(Close,120),BBC*-1);
// Get highest value before left side of cup started to form.
KC=Ref(HHV(Close,30),BLC*-1);
BKC=Ref(HHVBars(Close,120),BLC*-1);
Delta= LC/KC;
//Calculate the up/down relative price value during time frame RC (Right Cup Formation)
URPV=DRPV=0;
i=EndValue(BLH);
j=EndValue(BBC);
do
{
URPV =
IIf(Ref(Close,i*-1)>Ref(Close,(i+1)*-1),Ref(Volume,(i*-1))*Ref(Close,(i*-1))-Ref(Close,(i+1)*-1),URPV);
DRPV =
IIf(Ref(Close,i*-1)<Ref(Close,(i+1)*-1),Ref(Volume,(i*-1))*Ref(Close,(i+1)*-1)-Ref(Close,(i*-1)),DRPV);
i++;
} while (i<j);
Alpha = URPV/DRPV; // Should be >1
// Calculate Beta
DRPV=0;
i=EndValue(BBH);
j=EndValue(BLH);
do
{
DRPV =
IIf(Ref(Close,i*-1)<Ref(Close,(i+1)*-1),Ref(Volume,(i*-1))*Ref(Close,(i+1)*-1)-Ref(Close,(i*-1)),DRPV);
i++;
} while (i<j);
Beta = URPV/DRPV;
Gamma = log(Alpha) + log(Beta) + delta;
AddColumn(LH,"Left Handle");
AddColumn(BH,"Bottom Handle");
AddColumn(BC,"Bottom Cup");
AddColumn(LC,"Left Cup");
AddColumn(ALPHA,"Alpha");
AddColumn(DELTA,"Delta");
AddColumn(BETA,"BETA");
AddColumn(GAMMA,"Gamma");
// Filter Criteria as follows:
// 1. Right side of handle must be at least 2 bars. NBHL>2
// 2. Bottom of the cup must be lower than the left top of the cup.
// 3. Left handle must be lower than or equal to the lect cup formation.
// 4. Bottom of the cup must be less than the left handle.
// 5. Bottom of the handle must be > 80% of the left handle + 20% of the bottom cup.
// 6. Start of cup/handle formation must be greater than precedding chart value. LC>LC
// 7. Minimum price and volume you can set any way you like.
Filter= NBLH>2 AND Close>BH AND BC<LC AND LH<=LC AND BC<LH AND BH<LH AND BH>.8*LH+.2*BC AND KC<LC AND Close>MinPrice AND MA(Volume,30) > MinVolume;
_SECTION_END();
Mika, il s’agit plutôt d’un détecteur de demi tasse non ?
Je ne vois pas de tasse et hanse évidents de détectés dans le proscreener ; j’ai testé sur NASDAQ Daily ;
Sur quelle unité de temps le regardez-vous ?
Il s’agit d’une transposition (Amibroker semble-t-il) de l’approche de Rick Martinelli & Barry Hyman (forcément, vu la référence au HaihuLabs).
Elle concerne bien la tasse avec hanse.
Cependant Giorgios Siligardos a une autre approche dont le principe est appliqué dans le code de Nicolas, ce dernier ayant repris quelques figures plus avant dans le post l’illustrant /expliquant.
Pour rappel, j’ai indiqué :
“S’agissant de la ‘tasse’ avec ou sans hanse comme l’écrivait Giorgios Siligardos, ce dernier avait préconisé une approche de détection résumée dans un article payant (3$95…) uniquement disponible sur Traders.com, 026SILI.pdf. J’ai mentionné plus haut le lien vers une résumé (pdf de ppt) de son approche (‘matrice’).”
L’article contient un code Metastock, mais est sujet à droits d’auteurs ; je ne puis donc pas le copier sans autorisation.
De ce que je sais en bourse il n’y a pas de certitude mais une forte/moyenne/faible probabilité.
On ne va pas vous mettre l’argent dans la poches comme tomber du ciel.
Ce n’est pas un détecteur de 1/2 tasse. c’est un code qui a une forte/moyenne/faible probabilité de trier les figures représentant une figure chariste (tasse avec anse).
Il a l’aire d’aller dans se sens.
J’ai commencé à travailler le code fourni par Kris75, pas simple pour le moment. On doit enchaîner les boucles pour simuler les instructions de Amibroker. J’espère pouvoir m’y remettre avant la fin de semaine.
Merci Nicolas.
Ce n’est pas le premier cas qui nous confronte aux limites de la plateforme PRT, en ce qui concerne la pénalisation résultant de programmes utilisant des boucles, tant en temps de traitement, qu’en complexité des ‘work-arounds’.
Je réfléchis actuellement à une approche qui combinerait les deux directions prises dans les articles cités plus haut, à savoir les contraintes de taille de la figure (temps et prix), et la corrélation (simplifiée) basée sur les ‘boites’ temps/prix.
Je teste…mais certainement sans commune mesure avec la maîtrise de Nicolas !
On avance !
Bonjour à tous,
Bon j’ai avancé sur le code avec mon expertise très relative mais j’ai une erreur
“Ce ProScreener n’a pas pu être exécuté : l’une des instructions contient un offset négatif ou trop élevée (ex : low[-1] ou low[300]).
Les valeurs d’offset doivent être des entiers entre 0 et 254. ”
Je n’arrive pas à voir d’où cela vient ; quelqu’un aurait-il un idée ??(PI Nicolas est en vacances)
Merci
Chris
// Cup and Handle exploration written by Jerry Tyliczka
// visit us at: http://portals.wallstreettape.com
//
// This code written per specifications found at
// http://www.haikulabs.com/mh.htm
// Version 1.0
//
// This code calculates the Alpha, Delta, Beta and Gamma values
// but they are not used in the filter criteria as specified
// by the article which this code was based on.
//
// Look for additional changes as I tweak the below code.
// I will also include Scan feature and Backtesting in future release.
//
// Comments, please write to admin@wallstreettape.com
MinPrice=2.5
MinVolume=10000
//Left side of Handle formation can occur anywhere from 2-25days - look at the last 25 bars AND get the number of bars since condition met.
LH=highest[25](Close) // Highest close past 25 days.
BLH=barindex[LH] // Tells us # of bars that have past since high reached. Used to determine Lowest bar.
BH=lowest[BLH](Close) // Lowest close since the highest value was reached/
BBH=barindex[BH] // number of bars that have past since lowest value.
NBLH=BLH-BBH // this is the number of bars in the formation of the left side handle. NBLH must be atleast 2 to be a valid handle formation.
// Now lets get the cup formation. Cup formation can occur anywhere from 23 to 145 days. The left side of the cup can be from 20-120 days AND the right side can be anywhere from 3-25 days.
// get the right side of the cup(low).
BC=lowest[BLH+25](close) // look at 25 bars since the left side of handle.
BBC=barindex[BC]
// get the left side of the cup.
//
once LC = 0
once BLC =0
For index1 = 145 downto BBC do
if high[index1]> high[index1-1] then
LC=high[index1]
BLC=barindex[LC]
else
LC=LC
endif
Next
//
//// Get highest value before left side of cup started to form.
//
once KC = 0
//once BKC =0
For index2 = 205 downto BLC do
if high[index2]> high[index2-1] then
KC=high[index2]
//BKC=barindex[KC]
else
KC=KC
endif
Next
//
Delta= LC/KC
//
////Calculate the up/down relative price value during time frame RC (Right Cup Formation)
DRPV=0
URPV=DRPV
i=BLH
j=BBC
while i<j do
If Close[i] > Close[i+1] then
URPV = Volume[i]*Close[i]- Close[i+1]
else
UPRV=UPRV
endif
If Close[i] < Close[i+1] then
DRPV = Volume[i]*(Close[i+1]-Close[i])
else
DRPV = DRPV
endif
wend
Alpha = URPV/DRPV // Should be >1
// Calculate Beta
DRPV=0
j=BLH
k=BBH
while k<j do
If Close[j]< Close[j+1] then
DRPV = Volume[i]*(Close[i+1]-Close[i])
else
DRPV=DRPV
endif
wend
Beta = URPV/DRPV
Gamma = log(Alpha) + log(Beta) + delta
//
//AddColumn(LH,"Left Handle")
//AddColumn(BH,"Bottom Handle")
//AddColumn(BC,"Bottom Cup")
//AddColumn(LC,"Left Cup")
//AddColumn(ALPHA,"Alpha")
//AddColumn(DELTA,"Delta")
//AddColumn(BETA,"BETA")
//AddColumn(GAMMA,"Gamma")
// Filter Criteria as follows:
// 1. Right side of handle must be at least 2 bars. NBHL>2
// 2. Bottom of the cup must be lower than the left top of the cup.
// 3. Left handle must be lower than or equal to the lect cup formation.
// 4. Bottom of the cup must be less than the left handle.
// 5. Bottom of the handle must be > 80% of the left handle + 20% of the bottom cup.
// 6. Start of cup/handle formation must be greater than precedding chart value. LC>LC
// 7. Minimum price and volume you can set any way you like.
Screener [ NBLH>2 AND Close>BH AND BC<LC AND LH<=LC AND BC<LH AND BH<LH AND (BH>0.8*LH+0.2*BC) AND KC<LC AND Close>MinPrice AND average[30](Volume) > MinVolume and alpha > 1 and beta> 1](Gamma as "gamma")
Sur les lignes 44 et 59, index1 et index2 arrivent à -1, lorsque la limite zéro est atteinte.
Vous ne pouvez pas faire référence à une bougie <0 ou> 254.
Merci Roberto mais que feriez-vous ?
j’ai fait ces changements mais ca ne marche pas non plus ;
if high[index1+1]> high[index1] then
LC=high[index1+1]
if high[index2+1]> high[index2] then
KC=high[index2+1]
J’avoue ne pas comprendre car a priori BBC et BLC lignes 43 et 58 ne sont = 0 !
Merci de vos lumières !!
Une erreur est certainement à la ligne 23, parce que si vous êtes sur le Dax LH aura une valeur autour de 12600 et à la ligne 23, BLH aura une valeur de …. qui sait?!
Et puisque BLH est utilisé plusieurs fois plus tard, l’erreur se propage au reste du code.
Je n’ai pas entré la logique du code, mais je crois que la traduction n’est pas correcte.
À mon avis, il est conseillé d’attendre que Nicolas le remplisse, après quoi il peut être personnalisé.
Pour le traduire correctement (Nicolas a déjà dit que ce n’est pas facile), il faut savoir très bien le langage de programmation original et celui de ProRealTime!
Attendez que Nicolas revienne de vacances, alors son esprit sera en pleine forme!
Screener Détection Figure Tasse et Anse
This topic contains 66 replies,
has 8 voices, and was last updated by deletedaccount210122
5 years ago.
| Forum: | ProScreener : Scanners de Marché & Détection |
| Language: | French |
| Started: | 06/15/2018 |
| Status: | Active |
| Attachments: | 17 files |
The information collected on this form is stored in a computer file by ProRealCode to create and access your ProRealCode profile. This data is kept in a secure database for the duration of the member's membership. They will be kept as long as you use our services and will be automatically deleted after 3 years of inactivity. Your personal data is used to create your private profile on ProRealCode. This data is maintained by SAS ProRealCode, 407 rue Freycinet, 59151 Arleux, France. If you subscribe to our newsletters, your email address is provided to our service provider "MailChimp" located in the United States, with whom we have signed a confidentiality agreement. This company is also compliant with the EU/Swiss Privacy Shield, and the GDPR. For any request for correction or deletion concerning your data, you can directly contact the ProRealCode team by email at privacy@prorealcode.com If you would like to lodge a complaint regarding the use of your personal data, you can contact your data protection supervisory authority.