Bonjour
husserja ,
je n'avais pas vu votre message , oui il faut charger les 3 codes + ce dernier , ils sont en fait assez simple pas de calcul compliqué à posteriori , donc pas de ralentissement . il est possible aussi de les regrouper en un seul code. si le temps me le permet.
c'est un exemple avec 2 moyennes croisées , MACD et une ligne de tendance . juste à titre d'exemple car le plus compliqué c'est d’éliminer les bruits de fond ou les faux signaux
Code: Select all
express ExempleThreeConditions
vars
series EmaFast,EmaSlow,EmaSignal,macd,macdhisto,zero;
numeric i;
input $FastP(1,200,12),$SlowP(1,200,26),$Signal(1,200,9);
input $MaSlow(0,200,50), $MaFast (0,200,20);
series MaFast,MaSlow ;
string contract;
Numeric FlagUp ,FlagDown;
input $PlaySound("No;Yes",0);
series Line ;
calculation
if IsFirstBar() then
begin
CalculateAtEveryTick(false);
SetYscaleFormat(GetPriceFormat());
end
// Calculate the moving average convergence divergence
if IsFirstBar() then
begin
ExpMovingAverage(c,EmaFast,$FastP);
ExpMovingAverage(c,EmaSlow,$SlowP);
for i = 0 to FinalBarIndex()
macd[-i] = EmaFast[-i] - EmaSlow[-i];
ExpMovingAverage(macd,EmaSignal,$Signal);
for i = 0 to FinalBarIndex()
macdhisto[-i] = macd[-i] - EmaSignal[-i];
end
// Calculate the Average , slow and fast
if IsFirstBar() and IsBarCompleted()then
begin
MovingAverage(close, MaFast, $MaFast);
MovingAverage(close, MaSlow, $MaSlow);
end
// KijunSen
line = void;
if CurrentBarIndex() > 26 then
line = (highest(high, 26) + lowest(low,26)) / 2;
// 3 CDN
FlagUP = 0 ;
if (macdhisto > zero) then FlagUp = FlagUp + 1 ;
if (MaFast > MaSlow) then FlagUp = FlagUp + 1 ;
if (close > Line) then FlagUp = FlagUp + 1 ;
FlagDown = 0 ;
if (macdhisto < zero) then FlagDown = FlagDown + 1 ;
if (MaFast < MaSlow) then FlagDown = FlagDown + 1 ;
if (close < Line) then FlagDown = FlagDown + 1 ;
if FlagUp >= 3 and IsBarCompleted() then
begin
//MessageBox("Buy" + contract);
if ($PlaySound = 1) then Playsound("sell");
HighLightRGB ("slot" , 0 , 128 ,128 ) ;
end
if FlagDown >= 3 and IsBarCompleted() then
begin
//MessageBox("Sell" + contract);
if ($PlaySound = 1) then Playsound("buy");
HighLightRGB ("slot" , 255 , 102 ,0 ) ;
end
interpretation
begin
end
//plot (MaFast, white , 1);
//plot (MaSlow, white , 1) ;
//plot (line, white , 1)
//plotcandles(zero,macdhisto,macdhisto,zero);
//plot(macd,lightblue,1);
Empiriquement ce qui ralentit le programme, ceux sont les Multi applications ouvertes ( navigateur , streaming ...) ainsi que l'historique que l'on charge pour l'observation et/ou des calculs à chaque tick , dans l'express Analysis , on peut cocher "code analysis" à cet effet pour analyser un code . l"historique pour l'observation" et "réduire au minimum pour le trading" . ce qui est normal plus il y a de barres chargées de données ( UT1min , UTDay .... x jours d'historique ) plus la connexion , le programme , la mémoire vive sont sollicités .
Pour éviter le calcul à chaque tick par exemple on rajoute en début de programme
Code: Select all
if IsFirstBar() then
begin
CalculateAtEveryTick(false);
SetYscaleFormat(GetPriceFormat());
end
WHS Support , auriez vous s'il vous plait le code simplifié du supertrend(10,3) présent dans "indicator" ? celui-ci est trop complet
post6279.html?hilit=supertrend#p6279
Cordialemnt
Ceres