Bonjour Nicolas
j’ai crée un un petit algorythme basé sur l’amplitude des bougies et qui utilise la fonction ci-jointe.
Pour l’instant les variables lm et lm1 agissent sur l’ensemble de mes bougies. Je n’arrive pas à appliquer des variables différentes à chaque Bougie. Pour essayer d’être plus précis, je voudrais que chaque bougie puisse avoir un réglage des variables
lm et lm1 différentes.
Merci d’avance pour ton aide
cordialement
jp Saccucci
If longonmarket and close < positionprice and (barindex-tradeindex) > lm or bull=2 Then
Sell at market
endif
If longonmarket and close > positionprice and (barindex-tradeindex) >lm1 Then
Sell 0.8 contract at market
endif
Si ces variables ne sont pas fixes et calculés dynamiquement, alors elles possèdent déjà une valeur différente pour chaque bougie non ? 🙂
Bonjour Nicolas
apparemment non??
J’ai joins un bout de code. Dans ce code toutes les bougies vertes fermeront sur les variables lm,lm1 et lm2.Toutes les rouges sur sm,sm1 et sm2.
J’ai à peu près 50 bougies vertes et 60 bougies rouges. Je souhaiterais que pour chaque bougie pouvoir lui donner des variables différentes des autres bougies.
Je veux pouvoir dire . la bougie verte numéro1 va fermer lorsque le close > positionprice and (barindex-tradeindex) >5. La seconde > 8, la troisième supérieur à 10 etc etc.
a=2
b=11
c=2
d=7
fa=4
fb=5
bv1= (corps>=a*pipsize and verte) and (MecheSup >= c*pipsize and verte )and (MecheInf >= fa*pipsize and verte)
bv2= (corps<=b*pipsize and verte) and (MecheSup <=d*pipsize and verte ) and (MecheInf <= fb*pipsize and verte )
bv3=bv1 and bv2
if bv3 then
bull=1//AA
endif
e= 9//9
f=11//11
g=0//0
i=26//26
j=5//5
k=29//29
bv4= (corps>=e*pipsize and verte) and (MecheSup >= g*pipsize and verte )and (MecheInf >= j*pipsize and verte)
bv5= (corps<=f*pipsize and verte) and (MecheSup <=i*pipsize and verte ) and (MecheInf <= k*pipsize and verte )
bv6=bv4 and bv5
if bv6 then
bull=1//AB
endif
l=15
m=18
la=1
lb=2
lc=2
ld=3
bv7= (corps>=l*pipsize and verte) and (MecheSup >= la*pipsize and verte )and (MecheInf >= lc*pipsize and verte)
bv8= (corps<=m*pipsize and verte) and (MecheSup <=lb*pipsize and verte ) and (MecheInf <= ld*pipsize and verte )
bv9=bv7 and bv8
if bv9 then
bull=1//AC
endif
o=2//2
p=4//6
q=3//1
r=3//5
s=9//2
t=10//14
bv10= (corps>=o*pipsize and verte) and (MecheSup >= q*pipsize and verte )and (MecheInf >= s*pipsize and verte)
bv11= (corps<=p*pipsize and verte) and (MecheSup <=r*pipsize and verte ) and (MecheInf <= t*pipsize and verte )
bv12=bv10 and bv11
if bv12 then
bull=1//ad
endif
u=18
v=18
w=3
x=4
Y=0
z=0
bv13= (corps>=u*pipsize and verte) and (MecheSup >= w*pipsize and verte )and (MecheInf >= y*pipsize and verte)
bv14= (corps<=v*pipsize and verte) and (MecheSup <=x*pipsize and verte ) and (MecheInf <= z*pipsize and verte )
bv15=bv13 and bv14
if bv15 then
bull=1//AE
endif
ca=12
cb=12
cc=0
cd=1
ce=3
cf=3
bv16= (corps>=ca*pipsize and verte) and (MecheSup >= cc*pipsize and verte )and (MecheInf >= ce*pipsize and verte)
bv17= (corps<=cb*pipsize and verte) and (MecheSup <=cd*pipsize and verte ) and (MecheInf <= cf*pipsize and verte )
bv18=bv16 and bv17
if bv18 then
bull=1//AF
endif
cg=5
ch=6
ci=2
cj=2
ck=2
cl=3
bv19= (corps>=cg*pipsize and verte) and (MecheSup >= ci*pipsize and verte )and (MecheInf >= ck*pipsize and verte)
bv20= (corps<=ch*pipsize and verte) and (MecheSup <=cj*pipsize and verte ) and (MecheInf <= cl*pipsize and verte )
bv21=bv19 and bv20
if bv21 then
bull=1//AG
endif
ea=33
eb=33
ec=4
ed=5
ef=0
eg=0
bv22= (corps>=ea*pipsize and verte) and (MecheSup >= ec*pipsize and verte )and (MecheInf >= ef*pipsize and verte)
bv23= (corps<=eb*pipsize and verte) and (MecheSup <=ed*pipsize and verte ) and (MecheInf <= eg*pipsize and verte )
bv24=bv22 and bv23
if bv24 then
bull=1//AH
endif
eh=16
ei=17
ej=1
ek=1
el=4
em=4
bv25= (corps>=eh*pipsize and verte) and (MecheSup >= ej*pipsize and verte )and (MecheInf >= el*pipsize and verte)
bv26= (corps<=ei*pipsize and verte) and (MecheSup <=ek*pipsize and verte ) and (MecheInf <= em*pipsize and verte )
bv27=bv25 and bv26
if bv27 then
bull=1//AI
endif
en=10
eo=11
ep=0
eq=0
er=0
es=1
bv28= (corps>=en*pipsize and verte) and (MecheSup >= ep*pipsize and verte )and (MecheInf >= er*pipsize and verte)
bv29= (corps<=eo*pipsize and verte) and (MecheSup <=eq*pipsize and verte ) and (MecheInf <= es*pipsize and verte )
bv30=bv28 and bv29
if bv30 then
bull=1//AJ
endif
et=4
eu=5
ev=2
ew=2
ex=3
ey=3
bv31= (corps>=et*pipsize and verte) and (MecheSup >= ev*pipsize and verte )and (MecheInf >= ex*pipsize and verte)
bv32= (corps<=eu*pipsize and verte) and (MecheSup <=ew*pipsize and verte ) and (MecheInf <= ey*pipsize and verte )
bv33=bv31 and bv32
if bv33 then
bull=1//AK
endif
km=6
kn=6
ko=13
kp=14
kq=2
kr=3
ab31=(corps>=km*pipsize and verte) and (MecheSup >=ko*pipsize and verte )and (MecheInf >=kq*pipsize and verte)
ab32=(corps<=kn*pipsize and verte) and (MecheSup <=kp*pipsize and verte ) and (MecheInf <=kr*pipsize and verte )
ab33=ab31 and ab32
if ab33 then
bull=1//AL
endif
kg=8
kh=8
ki=0
kj=0
kk=3
kl=3
ab28=(corps>=kg*pipsize and verte) and (MecheSup >=ki*pipsize and verte )and (MecheInf >=kk*pipsize and verte)
ab29=(corps<=kh*pipsize and verte) and (MecheSup <=kj*pipsize and verte ) and (MecheInf <=kl*pipsize and verte )
ab30=ab28 and ab29
if ab30 then
bull=1//AM
endif
LA=4
lb=5
lc=0
ld=0
le=8
lf=9
ab34=(corps>=la*pipsize and verte) and (MecheSup >=lc*pipsize and verte )and (MecheInf >=le*pipsize and verte)
ab35=(corps<=lb*pipsize and verte) and (MecheSup <=ld*pipsize and verte ) and (MecheInf <=lf*pipsize and verte )
ab36=ab34 and ab35
if ab36 then
bull=1//AN
endif
ks=18
kt=18
ku=13
kv=13
kw=11
kx=11
ab34=(corps>=ks*pipsize and verte) and (MecheSup >=ku*pipsize and verte )and (MecheInf >=kw*pipsize and verte)
ab35=(corps<=kt*pipsize and verte) and (MecheSup <=kv*pipsize and verte ) and (MecheInf <=kx*pipsize and verte )
ab36=ab34 and ab35
if ab36 then
bull=1//AL
endif
ka1=21
ka2=22
ka3=0
ka4=1
ka5=0
ka6=1
ab37=(corps>=ka1*pipsize and verte) and (MecheSup >=ka3*pipsize and verte )and (MecheInf >=ka5*pipsize and verte)
ab38=(corps<=ka2*pipsize and verte) and (MecheSup <=ka4*pipsize and verte ) and (MecheInf <=ka6*pipsize and verte )
ab39=ab37 and ab38
if ab39 then
bull=1//AM
endif
ka7=3
ka8=3
ka9=0
ka10=0
ka11=3
ka12=3
ab40=(corps>=ka7*pipsize and verte) and (MecheSup >=ka9*pipsize and verte )and (MecheInf >=ka11*pipsize and verte)
ab41=(corps<=ka8*pipsize and verte) and (MecheSup <=ka10*pipsize and verte ) and (MecheInf <=ka12*pipsize and verte )
ab42=ab40 and ab40
if ab42 then
//bull=1//AN
endif
LA1=4
lb2=7
lc3=0
ld4=0
le5=4
lf6=40
ab40=(corps>=la1*pipsize and verte) and (MecheSup >=lc3*pipsize and verte )and (MecheInf >=le5*pipsize and verte)
ab41=(corps<=lb2*pipsize and verte) and (MecheSup <=ld4*pipsize and verte ) and (MecheInf <=lf6*pipsize and verte )
ab42=ab40 and ab41
if ab42 then
bull=1//AP
endif
Nt=2
nu=2
nv=0
nw=1
nx=25
ny=27
br33=(corps>=nt*pipsize and rouge) and(MecheSup >=nv*pipsize and rouge ) and (MecheInf >= nx*pipsize and rouge)//2
br34=(corps<=nu*pipsize and rouge)and (MecheSup <=nw*pipsize and rouge ) and (MecheInf <= ny*pipsize and rouge )//5
br35=br33 and br34
if br35 then
bull=1//VI attention bougie rouge dans achat c'est normal
endif
//___________________________________________________________________________________________________________________________
ab=7 //7
ac=29//29
ad=5//5
ae=31//31
af=1//1
ag=34//34
br1=(corps>=ab*pipsize and rouge) and(MecheSup >=ad*pipsize and rouge ) and (MecheInf >= af*pipsize and rouge)//2
br2=(corps<=ac*pipsize and rouge)and (MecheSup <ae*pipsize and rouge ) and (MecheInf <= ag*pipsize and rouge )//5
br3=br1 and br2
if br3 then
bull=2//VA
endif
ah=15
ai=17
aj=4
ak=6
al=4
am=6//7
br4=(corps>=ah*pipsize and rouge) and(MecheSup >=aj*pipsize and rouge ) and (MecheInf >= al*pipsize and rouge)//2
br5=(corps<=ai*pipsize and rouge)and (MecheSup <ak*pipsize and rouge ) and (MecheInf <= am*pipsize and rouge )//5
br6=br4 and br5
if br6 then
bull=2//VB
endif
an=5
ao=16
ap=4
aq=16
ar=1
au=16
br7= (corps>=an*pipsize and rouge) and(MecheSup >=ap*pipsize and rouge ) and (MecheInf >= ar*pipsize and rouge)//2
br8= (corps<=ao*pipsize and rouge)and (MecheSup <aq*pipsize and rouge ) and (MecheInf <= au*pipsize and rouge )//5
br9=br7 and br8
if br9 then
bull=2//VC
endif
aa1=6
aa2=7
aa3=1
aa4=2
aa5=4
aa6=6
br10= (corps>=aa1*pipsize and rouge) and(MecheSup >=aa3*pipsize and rouge ) and (MecheInf >= aa5*pipsize and rouge)//2
br11= (corps<=aa2*pipsize and rouge)and (MecheSup <aa4*pipsize and rouge ) and (MecheInf <= aa6*pipsize and rouge )//5
br12=br10 and br11
if br12 then
bull=2//VD
endif
NB=8
nc=9
nd=3
ne=4
nf=0
ng=1
br14=(corps>=nb*pipsize and rouge) and(MecheSup >=nd*pipsize and rouge ) and (MecheInf >= nf*pipsize and rouge)//2
br15=(corps<=nc*pipsize and rouge)and (MecheSup <=ne*pipsize and rouge ) and (MecheInf <= ng*pipsize and rouge )//5
br16=br14 and br15
if br16 then
BULL=2//VE
endif
PA=15
PB=16
pc=3
pd=4
pe=0
pf=0
bd30=(corps>=pa*pipsize and rouge) and(MecheSup >=pc*pipsize and rouge ) and (MecheInf >= pe*pipsize and rouge)//2
bd31=(corps<=pb*pipsize and rouge)and (MecheSup <=pd*pipsize and rouge ) and (MecheInf <= pf*pipsize and rouge )//5
bd32=bd30 and bd31
if bd32 then
//bull=2//VI
endif
Nh=8
ni=9
nj=3
nk=4
nl=20
nm=21
br17=(corps>=nh*pipsize and rouge) and(MecheSup >=nj*pipsize and rouge ) and (MecheInf >= nl*pipsize and rouge)//2
br18=(corps<=ni*pipsize and rouge)and (MecheSup <=nk*pipsize and rouge ) and (MecheInf <= nm*pipsize and rouge )//5
br19=br17 and br18
if br19 then
//bull=2//VH
endif
lm=18//coupure net//10
lm1=3// coupure partielle 1//6
lm2=4//coupure partielle 2//5
sm=3// coupure partielle 1//8
sm1=5// coupure partielle 2//10
sm2=11//coupure net short//11
If longonmarket and close < positionprice and (barindex-tradeindex) > lm Then
Sell at market
endif
If longonmarket and close > positionprice and (barindex-tradeindex) >lm1 Then
Sell 0.6 contract at market
endif
If longonmarket and close > positionprice and (barindex-tradeindex) > lm2 Then
Sell 0.3 contract at market
endif
If shortonmarket and close < positionprice and (barindex-tradeindex) >sm Then
exitshort 0.6 contract at market
endif
If shortonmarket and close < positionprice and (barindex-tradeindex) > sm1 Then
exitshort 0.3 contract at market
endif
If shortonmarket and close > positionprice and (barindex-tradeindex) > sm2 Then
exitshort at market
endif
IF NOT LONGONMARKET AND bull=1 THEN
BUY 1 CONTRACT AT MARKET
SET STOP ptrailing 38
set target pprofit 58
ELSIF not SHORTONMARKET and bull=2 THEN
SELLSHORT 1 CONTRACT AT MARKET
SET STOP ptrailing 45
set target pprofit 50
ENDIF
//graph bull=1 coloured(0,0,255)
//graph bull=2 coloured(255,0,0)
Entre les lignes 359 et 380, pour les fermetures des ordres, il n’y a pas de test de bougie rouge ou verte mais uniquement si le prix est supérieur à son entrée, même si c’est le cas, la bougie peut très bien être rouge.
verte = close>open
rouge = close<open