Pourquoi mon programme ne déclenche aucune entrée sur le marché
Je cherche pourquoi mon embryon de programme ne fonctionne pas en ce sens qu'il n'y a aucune entrée sur le marché
Express Dax_Crosses_Gex7_Gex2_auto_04022021
Vars
series G,i,cbi,senti;
series sign2,sign7,go_up,go_dw;
series up,dw,closeup,closedw;
series,Gex2,Gex2up,Gex2dw;
series Gex7,Gex7up,Gex7dw;
series Gex12,Gex12up,Gex12dw;
series Gex50,Gex50up,Gex50dw;
series DifGex2,DifGex7;
numeric position;
input $DGex2(1.0,3.0,1.4,0.1,1),$DGex7(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();
end
//-------------------------------
for i=0 to cbi
begin
G=(h+L+c)/3;
ExpMovingAverage(G,Gex2,2);
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;
ExpMovingAverage(G,Gex7,7);
ExpMovingAverage(G,Gex12,12);
MovingAverage(G,Gex50,-50);
DifGex2=Gex2[i]-Gex2[i+1];
DifGex7=Gex7[i]-Gex7[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 Gex7>=Gex7[1] then
begin
Gex7up=Gex7;Gex7up[1]=Gex7[1];
end else Gex7up=void;
if Gex7<Gex7[1] then
begin
Gex7dw=Gex7;
Gex7dw[1]=Gex7[1];
end else Gex7dw=void;
//-------------------------------
if Gex12>=Gex12[1] then
begin
Gex12up=Gex12;
Gex12up[1]=Gex12[1];
end else Gex12up=void;
if Gex12<Gex12[1] then
begin
Gex12dw=Gex12;
Gex12dw[1]=Gex12[1];
end else Gex12dw=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 IsFinalBar() then
if (DifGex2[i]>=$DGex2) then sign2=up;
else if (DifGex2[i]<-$DGex2) then sign2=dw;
if (DifGex7[i]>=$DGex7) then sign7=up;
else if (DifGex7[i]<-$DGex7) then sign7=dw;
if (sign2=up) AND (sign7=up) then go_up=1;
else if (sign2=dw) AND (sign7=dw) then go_dw=1;
if (position=1) AND (go_dw=1) then closeup
else if (position=-1) AND (go_up=1) then closedw=1;
//--------------------------------------------
if IsFinalBar() then ShowTip("DifGex2="+NumericToString(DifGex2,"%6.2f"
+"n\DifGex7="+NumericToString(DifGex7,"%6.2f")));
//------------------------------------------------
if go_up=1 then
begin
senti=100;
playsound("gong");
position=1;
end
else
if go_dw=1 then
begin
senti=0;
playsound("corkpop");
position=-1;
end
else
if closeup=1 then
begin
senti=40;
playsound("corkpop");
position=-1;
end
else
if closedw=1 then
begin
senti=60;
playsound("gong");
position=1;
end
else senti=50;
end
//---------------------------
INTERPRETATION
begin
sentiment=senti;
end
//---------------------------
plot(Gex2up,cyan,2);
plot(Gex2dw,magenta,2);
plot(Gex7up,lightblue,2);
plot(Gex7up,black,1);
plot(Gex7dw,lightred,2);
plot(Gex12up,lightgreen,2);
plot(Gex12up,black,1);
plot(Gex12dw,lightred,2);
plot(Gex50up,lightgreen,2);
plot(Gex50up,black,1);
plot(Gex50dw,lightred,2);
//-------------------------------

%20(1).png)
Merci Philippe,
Je vais tout reprendre avec tes données,
Pour ce qui est des ranges, je sais qu'il y a qq chose à faire,
Quant à closeup, closedw, il faut sans doute les remplacer par
un code de retournement (???),
Il faut aussi penser à dès que ça tourne un peu à mettre
des stop et target,