Comment coder ? - page 102

 

mmmm s'il vous plaît expliquer plus à ce sujet

J'ai aussi essayé les booléens et if() mais à première vue, ça ne marche pas.

 

Je ne peux pas en dire plus si je n'en vois pas plus...

mais il faut suivre les bases...

double a=iCustom(indiA) ;

double b=iCustum(indiB) ;

double c=iCustom(indiC) ;

int ORDer=0 ;

si( a==1 && b>0 && c!=0 ) ORDer=1 ;

si( a==-1 && b<0 && c!=0 ) ORDer=-1 ;

si(ORDer==1) BUY() ;

si(ORDer==-1) VENDRE() ;

payback:
mmmm s'il vous plaît expliquer plus à ce sujet aussi j'ai essayé booléen et if() mais à un premier regard ne fonctionne pas
 

ok ok ok !

En voilà plus !

double

BuyValueCurrent,

SellValuePrevious,

SellValueCurrent,

BuyValuePrevious2,

BuyValueCurrent2,

SellValuePrevious2,

SellValueCurrent2,

BuyValueCurrent1min,

BuyValueCurrent5min,

BuyValueCurrent21min,

BuyValueCurrent25min,

SellValueCurrent1min,

SellValueCurrent5min,

SellValueCurrent21min,

SellValueCurrent25min,

TrendEnvUp,

TrendEnvDown,

TrendEnvUp1min,

TrendEnvUp5min,

TrendEnvDown1min,

TrendEnvDown5min,

Compra,

Vendi,

StopLong,

StopSell;

[/php]

the icustom funcions and buy sell

BuyValuePrevious = iCustom(NULL,TimeFrame,IndicatorName1,NumBars,0,2);

BuyValueCurrent = iCustom(NULL,0,IndicatorName1,NumBars,1,0);

BuyValuePrevious2 = iCustom(NULL,TimeFrame,IndicatorName2,NumBars,0,2);

BuyValueCurrent2 = iCustom(NULL,0,IndicatorName2,NumBars,0,0);

SellValuePrevious = iCustom(NULL,TimeFrame,IndicatorName1,NumBars,1,2);

SellValueCurrent = iCustom(NULL,0,IndicatorName1,NumBars,0,0);

SellValuePrevious2 = iCustom(NULL,TimeFrame,IndicatorName1,NumBars,1,2);

SellValueCurrent2 = iCustom(NULL,0,IndicatorName2,NumBars,1,0);

BuyValueCurrent1min = iCustom(NULL,1,IndicatorName1,NumBars,1,0);

BuyValueCurrent5min = iCustom(NULL,5,IndicatorName1,NumBars,1,0);

BuyValueCurrent21min = iCustom(NULL,1,IndicatorName2,NumBars,0,0);

BuyValueCurrent25min = iCustom(NULL,5,IndicatorName2,NumBars,0,0);

SellValueCurrent1min = iCustom(NULL,1,IndicatorName1,NumBars,0,0);

SellValueCurrent5min = iCustom(NULL,5,IndicatorName1,NumBars,0,0);

SellValueCurrent21min = iCustom(NULL,1,IndicatorName2,NumBars,1,0);

SellValueCurrent25min = iCustom(NULL,5,IndicatorName2,NumBars,1,0);

TrendEnvUp = iCustom(NULL,0,IndicatorName4,Ma_Period,Ma_Shift,Ma_Method,Applied_Price,Deviation,0,0); // trendenvelopes

TrendEnvDown = iCustom(NULL,0,IndicatorName4,Ma_Period,Ma_Shift,Ma_Method,Applied_Price,Deviation,1,0); // trendenvelopes

TrendEnvUp1min = iCustom(NULL,1,IndicatorName4,Ma_Period,Ma_Shift,Ma_Method,Applied_Price,Deviation,0,0);

TrendEnvUp5min = iCustom(NULL,5,IndicatorName4,Ma_Period,Ma_Shift,Ma_Method,Applied_Price,Deviation,0,0);

TrendEnvDown1min = iCustom(NULL,1,IndicatorName4,Ma_Period,Ma_Shift,Ma_Method,Applied_Price,Deviation,1,0);

TrendEnvDown5min = iCustom(NULL,5,IndicatorName4,Ma_Period,Ma_Shift,Ma_Method,Applied_Price,Deviation,1,0);

BuyCondition = (BuyValueCurrent !=0 && BuyValueCurrent2 !=0 && TrendEnvUp != EMPTY_VALUE)&& (BuyValueCurrent1min !=0 && BuyValueCurrent21min !=0 && TrendEnvUp1min != EMPTY_VALUE) && (BuyValueCurrent5min !=0 && BuyValueCurrent25min !=0 && TrendEnvUp5min != EMPTY_VALUE) ;

SellCondition = (SellValueCurrent !=0 && SellValueCurrent2 !=0 && TrendEnvDown != EMPTY_VALUE)&& (SellValueCurrent1min != 0 && SellValueCurrent21min != 0 && TrendEnvDown1min != EMPTY_VALUE)&& (SellValueCurrent5min != 0 && SellValueCurrent25min != 0 && TrendEnvDown5min != EMPTY_VALUE) ;

StopLong = ((SellValueCurrent !=0 && SellValueCurrent2 !=0) || (TrendEnvDown != EMPTY_VALUE));

StopSell = ((BuyValueCurrent !=0 && BuyValueCurrent2 !=0) || (TrendEnvUp != EMPTY_VALUE));

the exit condition

[php]

StopBuy = (SellValueCurrent !=0 && SellValueCurrent2 !=0 || TrendEnvDown != EMPTY_VALUE);

StopSell = (BuyValueCurrent !=0 && BuyValueCurrent2 !=0 || TrendEnvUp != EMPTY_VALUE);

 

changez-les...

Ainsi, toutes les conditions sont fausses et restent fausses jusqu'à ce que les conditions if() soient vraies.

Enlevez le StopLong & StopSell dans "double", tous les autres "double" peuvent rester.

Ceci va le faire pour vous !

bool BuyCondition=false ;

bool SellCondition=false ;

bool StopLong=false ;

bool StopSell=false ;

if((BuyValueCurrent !=0 && BuyValueCurrent2 !=0 && TrendEnvUp != EMPTY_VALUE) && (BuyValueCurrent1min !=0 && BuyValueCurrent21min !=0 && TrendEnvUp1min != EMPTY_VALUE) && (BuyValueCurrent5min !=0 && BuyValueCurrent25min !=0 && TrendEnvUp5min != EMPTY_VALUE)) {BuyCondition=true;}

if((SellValueCurrent !=0 && SellValueCurrent2 !=0 && TrendEnvDown != EMPTY_VALUE) && (SellValueCurrent1min != 0 && SellValueCurrent21min != 0 && TrendEnvDown1min != EMPTY_VALUE) && (SellValueCurrent5min != 0 && SellValueCurrent25min != 0 && TrendEnvDown5min != EMPTY_VALUE)) {SellCondition=true;}

if((SellValueCurrent !=0 && SellValueCurrent2 !=0) || (TrendEnvDown != EMPTY_VALUE)) {StopLong=true;}

if((BuyValueCurrent !=0 && BuyValueCurrent2 !=0) || (TrendEnvUp != EMPTY_VALUE)) {StopSell=true;}

payback:
ok ok ok !

en voici d'autres !

double

BuyValueCurrent,

SellValuePrevious,

SellValueCurrent,

BuyValuePrevious2,

BuyValueCurrent2,

SellValuePrevious2,

SellValueCurrent2,

BuyValueCurrent1min,

BuyValueCurrent5min,

BuyValueCurrent21min,

BuyValueCurrent25min,

SellValueCurrent1min,

SellValueCurrent5min,

SellValueCurrent21min,

SellValueCurrent25min,

TrendEnvUp,

TrendEnvDown,

TrendEnvUp1min,

TrendEnvUp5min,

TrendEnvDown1min,

TrendEnvDown5min,

Compra,

Vendi,

StopLong,

StopSell;

[/php]the icustom funcions and buy sell

BuyValuePrevious = iCustom(NULL,TimeFrame,IndicatorName1,NumBars,0,2);

BuyValueCurrent = iCustom(NULL,0,IndicatorName1,NumBars,1,0);

BuyValuePrevious2 = iCustom(NULL,TimeFrame,IndicatorName2,NumBars,0,2);

BuyValueCurrent2 = iCustom(NULL,0,IndicatorName2,NumBars,0,0);

SellValuePrevious = iCustom(NULL,TimeFrame,IndicatorName1,NumBars,1,2);

SellValueCurrent = iCustom(NULL,0,IndicatorName1,NumBars,0,0);

SellValuePrevious2 = iCustom(NULL,TimeFrame,IndicatorName1,NumBars,1,2);

SellValueCurrent2 = iCustom(NULL,0,IndicatorName2,NumBars,1,0);

BuyValueCurrent1min = iCustom(NULL,1,IndicatorName1,NumBars,1,0);

BuyValueCurrent5min = iCustom(NULL,5,IndicatorName1,NumBars,1,0);

BuyValueCurrent21min = iCustom(NULL,1,IndicatorName2,NumBars,0,0);

BuyValueCurrent25min = iCustom(NULL,5,IndicatorName2,NumBars,0,0);

SellValueCurrent1min = iCustom(NULL,1,IndicatorName1,NumBars,0,0);

SellValueCurrent5min = iCustom(NULL,5,IndicatorName1,NumBars,0,0);

SellValueCurrent21min = iCustom(NULL,1,IndicatorName2,NumBars,1,0);

SellValueCurrent25min = iCustom(NULL,5,IndicatorName2,NumBars,1,0);

TrendEnvUp = iCustom(NULL,0,IndicatorName4,Ma_Period,Ma_Shift,Ma_Method,Applied_Price,Deviation,0,0); // trendenvelopes

TrendEnvDown = iCustom(NULL,0,IndicatorName4,Ma_Period,Ma_Shift,Ma_Method,Applied_Price,Deviation,1,0); // trendenvelopes

TrendEnvUp1min = iCustom(NULL,1,IndicatorName4,Ma_Period,Ma_Shift,Ma_Method,Applied_Price,Deviation,0,0);

TrendEnvUp5min = iCustom(NULL,5,IndicatorName4,Ma_Period,Ma_Shift,Ma_Method,Applied_Price,Deviation,0,0);

TrendEnvDown1min = iCustom(NULL,1,IndicatorName4,Ma_Period,Ma_Shift,Ma_Method,Applied_Price,Deviation,1,0);

TrendEnvDown5min = iCustom(NULL,5,IndicatorName4,Ma_Period,Ma_Shift,Ma_Method,Applied_Price,Deviation,1,0);

BuyCondition = (BuyValueCurrent !=0 && BuyValueCurrent2 !=0 && TrendEnvUp != EMPTY_VALUE)&& (BuyValueCurrent1min !=0 && BuyValueCurrent21min !=0 && TrendEnvUp1min != EMPTY_VALUE) && (BuyValueCurrent5min !=0 && BuyValueCurrent25min !=0 && TrendEnvUp5min != EMPTY_VALUE) ;

SellCondition = (SellValueCurrent !=0 && SellValueCurrent2 !=0 && TrendEnvDown != EMPTY_VALUE)&& (SellValueCurrent1min != 0 && SellValueCurrent21min != 0 && TrendEnvDown1min != EMPTY_VALUE)&& (SellValueCurrent5min != 0 && SellValueCurrent25min != 0 && TrendEnvDown5min != EMPTY_VALUE) ;

StopLong = ((SellValueCurrent !=0 && SellValueCurrent2 !=0) || (TrendEnvDown != EMPTY_VALUE));

StopSell = ((BuyValueCurrent !=0 && BuyValueCurrent2 !=0) || (TrendEnvUp != EMPTY_VALUE));

the exit condition

[php]

StopBuy = (SellValueCurrent !=0 && SellValueCurrent2 !=0 || TrendEnvDown != EMPTY_VALUE);

StopSell = (BuyValueCurrent !=0 && BuyValueCurrent2 !=0 || TrendEnvUp != EMPTY_VALUE);

 

Merci, je vais essayer ce soir !

 

Une question stupide : tout ce qui est à l'intérieur du {} est votre commentaire ou je dois l'écrire ? et pourquoi ? pourquoi {;} et pas {} ; ?

Et aussi, est-ce que je peux toujours utiliser cette déclaration ?

if(SellCondition)

{

ticket = subOpenOrder(OP_SELL,NewStopLossSell,TakeProfit,TicketComment); // open SELL order

subCheckError(ticket,"SELL");

LastTrade = "SELL";

return(0);

[/php]

or i have to write:

[php]

if(SellCondition = true)

{

ticket = subOpenOrder(OP_SELL,NewStopLossSell,TakeProfit,TicketComment); // open SELL order

subCheckError(ticket,"SELL");

LastTrade = "SELL";

return(0);

 

Besoin d'aide pour coder une simple ea, s'il vous plaît...

Bonjour à tous,

Je voudrais remercier tous ceux qui m'ont aidé dans le passé. Maintenant, j'ai une nouvelle demande.

Quelqu'un peut-il m'aider à coder cette ea et voici les paramètres :

Mon ea est basé sur une barre doji et une barre inside.

Pour une barre intérieure :

Placez un BUY-STOP/BUY-LIMIT au HIGH de la prochaine barre.

Placez un SELL-STOP/SELL-LIMIT au LOW de la prochaine barre.

Clarifications :

La barre intérieure est la barre 0 (zéro)

La barre suivante est celle où nous allons placer la limite d' achat et de vente ou le stop.

La barre suivante est celle où la position longue ou courte sera déclenchée.

Sur un graphique d'une heure, si nous avons une barre intérieure à 9 heures du matin, alors nous plaçons notre BUY-STOP ou LIMIT et notre SELL-Stop otr LIMIT au niveau du haut et du bas de la barre de 10 heures du matin. Le long ou le shor sera déclenché à la barre de 11 heures, à condition que le prix soit supérieur ou inférieur à celui de la barre de 10 heures.

Pour une barre Doji :

Placez un BUY-STOP/BUY-LIMIT au HIGH de la barre précédente.

Placez un SELL-STOP/SELL-LIMIT au LOW de la barre précédente.

Clarifications :

La barre Doji est la barre 0 (zéro)

La barre précédente ou la barre avant le doji est celle où nous allons placer les limites d'achat et de vente ou le stop au niveau du haut et du bas.

La barre après la barre doji est celle où la position longue ou courte sera déclenchée.

Sur un graphique d'une heure, si nous avons une barre en doji à 9 heures du matin, alors nous plaçons notre BUY-STOP ou LIMIT et notre SELL-Stop otr LIMIT au niveau du haut et du bas de la barre de 8 heures du matin. Le long ou le shor sera déclenché à la barre de 10 heures, à condition que le prix soit supérieur ou inférieur à celui de la barre de 8 heures.

...peut-être, ce n'est pas si simple. Si ça l'était, je l'aurais fait il y a deux semaines.

Merci d'avance !

Meilleures salutations,

forexcel

 

Ce ne sont pas des commentaires, c'est du code.

Ils font partie de votre instruction if().

if(SellCondition){

...

retour(0) ;

}

if(SellCondition==true){

...

return(0) ;

}

les deux instructions sont correctes, vous pouvez utiliser l'une ou l'autre...

mais voyez que chaque instruction if() se termine par }

cela n'apparaît pas dans le code que vous fournissez ici.

autre exemple :

if(a==b){c=1 ; d=2 ; return(0);}

payback:
Une question stupide : tout ce qui est à l'intérieur du {} est votre commentaire ou je dois l'écrire ? et pourquoi ? pourquoi {;} et pas {} ; ?

Je peux toujours utiliser cette instruction, n'est-ce pas ?

if(SellCondition)

{

ticket = subOpenOrder(OP_SELL,NewStopLossSell,TakeProfit,TicketComment); // open SELL order

subCheckError(ticket,"SELL");

LastTrade = "SELL";

return(0);

[/php]

or i have to write:

[php]

if(SellCondition = true)

{

ticket = subOpenOrder(OP_SELL,NewStopLossSell,TakeProfit,TicketComment); // open SELL order

subCheckError(ticket,"SELL");

LastTrade = "SELL";

return(0);

 

ahhhhhh j'ai parfaitement compris thx !!!!

je revois mon C de l'université c'est la même chose

en tout cas merci beaucoup !!!

 

J'ai trouvé quelques indicateurs pour commencer...

il y a aussi un EA, mais il n'est pas très performant je pense, j'ai juste fait un test rapide...

Dossiers :
Raison: