Examen d'un projet de programme
Ci-joint un programme qui a besoin d’être contrôlé et amélioré, des questions sont indiquées au milieu entre le programme et les Targets et Stops,
Merci à tous et toutes,
Express Dax_Crosses_Gex72_Gex122_auto_essai03_18032021
VARS series G,i,cbi,senti;
series sign2,sign72,sign122,OK;
series,Gex2,Gex2up,Gex2dw;
series Gex7,Gex7up,Gex7dw;
series Gex72,Gex72up,Gex72dw;
series Gex12,Gex12up,Gex12dw;
series Gex122,Gex122up,Gex122dw;
series Gex50,Gex50up,Gex50dw;
series DifGex2,DifGex72,DifGex122;
numeric position,tickSize,entryPrice,cbi;
input $DGex2(1.0,3.0,1.4,0.1,1),$DGex72(1.0,3.0,1.4,0.1,1);
input $butlg(8,30,18),$butsh(8,30,18);
//-----------------------------------------------
CALCULATION
if IsFirstBar() then
begin
CalculateAtEveryTick(false);
SetYscaleformat(GetPriceFormat());
cbi=CurrentBarIndex();
entryPrice=EntryPrice Original (); tickSize=TickSize();
end
//-------------------------------
for i=0 to cbi
begin
G=(h+L+c)/3;
//------------------------------------
ExpMovingAverage(G,Gex2,2);
ExpMovingAverage(G,Gex7,7);
MovingAverage(Gex7,Gex72,2);
ExpMovingAverage(G,Gex12,12);
MovingAverage(G,Gex50,-30);
MovingAverage(Gex12,Gex122,-2);
DifGex2=Gex2[i]-Gex2[i+1];
DifGex72=Gex72[i]-Gex72[i+1];
DifGex122=Gex122[i]-Gex122[i+1];
//-------------------------------
if Gex2>=Gex2[1] then
begin Gex2up=Gex2;Gex2up[1]=Gex2[1];
end else Gex2up=void;
if Gex2<Gex2[1] then
begin Gex2dw=Gex2;Gex2dw[1]=Gex2[1];
end else Gex2dw=void;
//------------------------------------
if Gex50>=Gex50[1] then
begin Gex50up=Gex50;Gex50up[1]=Gex50[1];
end else Gex50up=void;
if Gex50<Gex50[1] then
begin Gex50dw=Gex50;Gex50dw[1]=Gex50[1];
end else Gex50dw=void;
//------------------------------------
if Gex72>=Gex72[1] then
begin Gex72up=Gex72;Gex72up[1]=Gex72[1];
end else Gex72up=void;
if Gex7<Gex72[1] then
begin Gex72dw=Gex72;Gex72dw[1]=Gex72[1];
end else Gex72dw=void;
//----------------------------------
if Gex122>=Gex122[1] then
begin Gex122up=Gex122; Gex122up[1]=Gex122[1];
end else Gex122up=void;
if Gex122<Gex122[1] then
begin Gex122dw=Gex122; Gex122dw[1]=Gex122[1];
end else Gex122dw=void;
//-----------------------------------
//if (Gex2>0) AND (h-open>0) then OK=1;
//else if (Gex2<0) AND (L-Open<0) then OK=-1;
if (DifGex2>0) AND (DifGex72>0) AND (DifGex122>0) then OK=1;
else if (DifGex2<0) AND (DifGex72<0) AND (DifGex122<0) then OK=-1;
//-------------------------------------------
if OK=1 then
begin
highlightat(0,"slot","green");
senti=100;
playsound("gong");
position=1;
OK=0;
end
else if OK=-1 then
begin
highlightat(0,"slot","lightred");
senti=0;
playsound("corkpop");
position=-1;
OK=0;
end
else senti=50;
end
//--------------------------------------------
if IsFinalBar() then ShowTip("DifGex2="+NumericToString(DifGex2,"%6.2f"
+"n\DifGex7="+NumericToString(DifGex72,"%6.2f")));
//------------------------------------------------
INTERPRETATION
begin
sentiment=senti;
end
//---------------------------
plot(Gex2up,cyan,1);
plot(Gex2dw,magenta,1);
plot(Gex50up,lightgreen,2);
plot(Gex50up,black,1);
plot(Gex50dw,lightred,2);
plot(Gex72up,lightblue,2);
plot(Gex72up,black,1);
plot(Gex72dw,lightred,2);
plot(Gex122up,lightgreen,2);
plot(Gex122up,black,1);
plot(Gex122dw,lightred,2);
//-------------------------------
A-Concernant le programme :
1 je souhaiterais une bougie uniquement lorsque l’ordre d’entrée apparaît
mais aussi que les couleurs soient moins vives car elles cachent le graphique, comment arriver à un vert plus clair et à un rouge un peu rosi, où trouver comment manipuler les couleurs,
2 le ShowTip ne me permet et pas de lire ce qui est indiqué Et n’hésitez pas à signaler tout ce qui est à modifier ou améliorer,
B-Pour les targets comme pour les stops :
1 je me souviens d’avoir vu sur Mogalef Trading qu’Eric avait un target intéressant, j’aimerais le connaître et le tester,
2 quant au stop pourquoi ne pas prendre ce qui a déjà été mis au point par Éric (je lui ai juste emprunté ce que j’ai crû comprendre de sa méthodologie lorsque le Target n’est pas atteint), mais le détail est à préciser en fonction de l’expérience acquise,
Et n’hésitez pas à signaler tout ce qui est à modifier ou à améliorer,
C-Reste peut-être le plus difficile :
quand ne pas trader (ou stopper le trade en cours)
ou autre aspect : quand trader,
//-----------------------------------------------------------
Express Stop MonTargetGex72_18032021
VARS
series sumhb,delta,dhb,xh,yb,i;
series TargetLevel;
Numeric entryPrice,tickSize;
Input $n(3,8,4),$k(1.0,2.0,1.5,0.1,1), $butlg(10,30,20),$butsh(10,30,20);
CALCULATION
SetIntraPeriodUpdate();
if IsFirstBar() then
begin
CalculateAtEveryTick(false);
entryPrice=EntryPriceOriginal();
tickSize=TickSize();
end
//-------------------------------
sumhb=0;
for i=$n downto 0
begin
delta=high[$n]-low[$n];
sumhb=sumhb+delta;
end
dhb=sumhb/($n+1);
xh=low+(dhb*$k);
yb=high-(dhb*$k);
//---------------------------------
if MarketPosition()>0 then
begin
if BarsSinceEntry()<$n then TargetLevel=$butlg*tickSize;
else
TargetLevel=max(xh*tickSize,$butlg*tickSize);
SetTargetPrice(TargetLevel);
end
else
if MarketPosition()<0 then
begin
if BarsSinceEntry()<$n then TargetLevel=$butsh*tickSize;
else
TargetLevel=min(yb*tickSize,$butsh*tickSize);
SetTargetPrice(TargetLevel);
end
//---------------------
Express Stop MonStopGex72_18032021
VARS
series x,sumhb,delta,dhb,i;
series xh,yb;
series StopLevel;
Numeric entryPrice,tickSize;
Input $n(3,8,4),$k(1.2,2.0,1.5,0.1,1),$q(2,10,4) ;
CALCULATION
SetIntraPeriodUpdate();
if IsFirstBar() then
begin
CalculateAtEveryTick(false);
entryPrice=EntryPriceOriginal();
tickSize=TickSize();
end
//---------------------
sumhb=0;
for x=0 to $n
begin
delta=high[x]-low[x];
sumhb=sumhb+delta;
end
dhb=sumhb/($n+1);
xh=high-dhb*$k;
yb=low+dhb*$k;
//-------------------------------
if MarketPosition()>0 then
begin
if BarsSinceEntry()<$n then StopLevel=entryPrice()-$q*ticksize ;
else
StopLevel=max(StopLevel,xh*tickSize);
SetStopPrice(StopLevel);
end
else
if MarketPosition()<0 then
begin
if BarsSinceEntry()<$n then StopLevel=entryPrice()+$q*tickSize ;
else
StopLevel=min(StopLevel,yb*tickSize);
SetStopPrice(StopLevel);
end
//-------------------------------------------

%20(1).png)
Je suis d'accord pour suivre votre conseil et en prendre la première bougie comme signal, il n'en reste pas moins que même dans ce cas il arrive que la première bougie peut nous entrainer dans une impasse, C'est peut-être là qu'il faut utiliser les target et/ou stop dont vous parlez,