Aide au codage - page 490

 
tfi_markets:
Mettre en œuvre ; indicateur NonLag_Schaff_TrendCycle:

Bonjour Pro-Coders,

Je me demande si quelqu'un pourrait m'aider à implémenter l'indicateur NonLag_Schaff_TrendCycle.

Externes de l'indicateur :

extern int FastLength = 23 ;

extern int SlowLength = 50 ;

extern int StcPeriod = 10 ;

extern int MacdPrice = PRICE_CLOSE ;

extern bool Interpolate = true ;

extern bool MultiColor = true ;

Tampons d'indicateurs :

IndicatorBuffers(8) ;

SetIndexBuffer(0,stcBuffer) ;

SetIndexBuffer(1,stcBufferUA) ;

SetIndexBuffer(2,stcBufferUB) ;

SetIndexBuffer(3,macdBuffer) ;

SetIndexBuffer(4,fastKBuffer) ;

SetIndexBuffer(5,fastDBuffer) ;

SetIndexBuffer(6,fastKKBuffer) ;

SetIndexBuffer(7,trend) ;

J'essaie de faire quelque chose comme

double STC1_c=iCustom(Symbol(),0, "NonLag_Schaff_TrendCycle",FastLength,SlowLength,StcPeriod,MacdPrice,Interpolate,0,bar) ;

double STC2_c=iCustom(Symbol(),0, "NonLag_Schaff_TrendCycle",FastLength,SlowLength,StcPeriod,MacdPrice,Interpolate,0,bar+1) ;

if((STC1_c>15 && STC2_c85 && STC2_c BUY

if((STC1_c15)||(STC1_c85) -> VENDRE

Mais je reçois un message d'erreur :

Error : NonLag_Schaff_TrendCycle a été supprimé.

Je suppose que j'ai peut-être mal lu les tampons. Quelqu'un a-t-il une suggestion ?

Merci d'avance !

Le premier paramètre du cycle de tendance schaf nonlag est "TimeFrame". Il manque dans l'appel iCustom. L'appel iCustom() devrait être comme ceci :

iCustom(Symbol(),0, "NonLag_Schaff_TrendCycle","",FastLength,SlowLength,StcPeriod,MacdPrice,Interpolate,0,bar) ;

 

Besoin d'aide

Bonjour mladen

merci pour votre aide passée

j'ai essayé de faire cet indicateur mais il n'apparaît pas

alors s'il vous plaît aidez-moi à nouveau

Merci d'avance

mtf_rsi_candle_all_in_one.mq4

Dossiers :
 

Salut Mladen,

merci beaucoup pour votre aide. Maintenant cela fonctionne

Avec mes salutations distinguées,

Thomas

mladen:
Le premier paramètre du cycle de tendance schaf sans drapeau est "TimeFrame". Vous l'avez oublié dans l'appel iCustom. L'appel iCustom() devrait être comme ceci : iCustom(Symbol(),0, "NonLag_Schaff_TrendCycle","",FastLength,SlowLength,StcPeriod,MacdPrice,Interpolate,0,bar) ;
 

Salut, Mladen !

Lorsque le nouveau build est long, l'optimisation se fait.

Si l'on revient à la version 670, la vitesse d'optimisation est bonne.

Quel pourrait être le problème ?

experttsi.mq4

tsi.mq4

Dossiers :
experttsi.mq4  2 kb
tsi.mq4  4 kb
 
QuantF:
Salut, Mladen !

Quand la nouvelle construction est longue, l'optimisation est faite.

Si l'on revient à la version 670, la vitesse d'optimisation est bonne.

Quel pourrait être le problème ?

experttsi.mq4

tsi.mq4

Tout d'abord, dans l'indicateur TSI, supprimez la ligne qui se présente comme suit :

#property strict

Avec cette ligne, il ne fonctionnera pas

______________

Pour le reste : nous devons tous espérer et prier. Avec chaque nouvelle version, le backtesting est de plus en plus lent (voir la plainte de la version 840). Il n'y a pas grand chose à faire. On en est arrivé au point où le backtesting visuel est plus rapide que le backtesting normal (la build 788 est celle que j'utilise) et il n'y a aucune logique dans tout cela.

 

Bonjour Pro Coders,

pour une raison quelconque, mon EA ferme des positions mais n'en ouvre pas de nouvelles, après que la tendance ait changé. Quelqu'un pourrait-il y jeter un coup d'oeil ?

Merci d'avance !

//----------------------- LOAD INDICATORS FOR CLOSING POSITIONS

double STC0_c=iCustom(Symbol(),0,"NonLag_Schaff_TrendCycle","",FastLength,SlowLength,StcPeriod,MacdPrice,Interpolate,MultiColor,0,bar+2);

double STC1_c=iCustom(Symbol(),0,"NonLag_Schaff_TrendCycle","",FastLength,SlowLength,StcPeriod,MacdPrice,Interpolate,MultiColor,0,bar+1);

double STC2_c=iCustom(Symbol(),0,"NonLag_Schaff_TrendCycle","",FastLength,SlowLength,StcPeriod,MacdPrice,Interpolate,MultiColor,0,bar);

// for(int i=0;i<OrdersTotal(); i++)

for(int i=OrdersTotal()-1;i>=0 ; i--)

{

if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) break;

if(OrderMagicNumber()!= MAGIC)continue;

if(OrderSymbol()!= s_symbol) continue;

//----------------------- CLOSE BUY CONDITION

if(STC1_c!=STC2_c) // Check trend

{

if(OrderType()==OP_BUY)

{

if(STC1_c>STC0_c&&STC2_c<STC1_c)

{

bool buyClose=OrderClose(OrderTicket(),OrderLots(),MarketInfo(s_symbol,MODE_BID),Slippage*pipMultiplier,clCloseBuy);

if(buyClose==false)

{

int ErrorCode = GetLastError();

string ErrDesc = ErrorDescription(ErrorCode);

string ErrAlert= StringConcatenate("Close Buy Order - Error ",ErrorCode,": ",ErrDesc);

if(ShowAlerts == true) Alert(ErrAlert);

string ErrLog=StringConcatenate("Bid: ",MarketInfo(s_symbol,MODE_BID)," Lots: ",OrderLots()," Ticket: ",OrderTicket());

Print(ErrLog);

}

break;

} // mod

}

}

//----------------------- CLOSE SELL CONDITION

if(STC1_c!=STC2_c)

{

if(OrderType()==OP_SELL)

{

if(STC1_cSTC1_c)

{

bool sellClose= OrderClose(OrderTicket(),OrderLots(),MarketInfo(s_symbol,MODE_ASK),Slippage*pipMultiplier,clCloseSell);

if(sellClose == false)

{

ErrorCode = GetLastError();

ErrDesc = ErrorDescription(ErrorCode);

ErrAlert=StringConcatenate("Close Sell Order - Error ",ErrorCode,": ",ErrDesc);

if(ShowAlerts==true) Alert(ErrAlert);

ErrLog=StringConcatenate("Ask: ",MarketInfo(s_symbol,MODE_ASK)," Lots: ",OrderLots()," Ticket: ",OrderTicket());

Print(ErrLog);

}

break;

} // mod

}

}

}

}

Dossiers :
trendcycle.jpg  97 kb
 
tfi_markets:
Salut Pro Coders,

Pour une raison quelconque, mon EA ferme des positions mais n'en ouvre pas de nouvelles, après que la tendance ait changé. Quelqu'un pourrait-il y jeter un coup d'œil ?

Merci d'avance !

//----------------------- LOAD INDICATORS FOR CLOSING POSITIONS

double STC0_c=iCustom(Symbol(),0,"NonLag_Schaff_TrendCycle","",FastLength,SlowLength,StcPeriod,MacdPrice,Interpolate,MultiColor,0,bar+2);

double STC1_c=iCustom(Symbol(),0,"NonLag_Schaff_TrendCycle","",FastLength,SlowLength,StcPeriod,MacdPrice,Interpolate,MultiColor,0,bar+1);

double STC2_c=iCustom(Symbol(),0,"NonLag_Schaff_TrendCycle","",FastLength,SlowLength,StcPeriod,MacdPrice,Interpolate,MultiColor,0,bar);

// for(int i=0;i<OrdersTotal(); i++)

for(int i=OrdersTotal()-1;i>=0 ; i--)

{

if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) break;

if(OrderMagicNumber()!= MAGIC)continue;

if(OrderSymbol()!= s_symbol) continue;

//----------------------- CLOSE BUY CONDITION

if(STC1_c!=STC2_c) // Check trend

{

if(OrderType()==OP_BUY)

{

if(STC1_c>STC0_c&&STC2_c<STC1_c)

{

bool buyClose=OrderClose(OrderTicket(),OrderLots(),MarketInfo(s_symbol,MODE_BID),Slippage*pipMultiplier,clCloseBuy);

if(buyClose==false)

{

int ErrorCode = GetLastError();

string ErrDesc = ErrorDescription(ErrorCode);

string ErrAlert= StringConcatenate("Close Buy Order - Error ",ErrorCode,": ",ErrDesc);

if(ShowAlerts == true) Alert(ErrAlert);

string ErrLog=StringConcatenate("Bid: ",MarketInfo(s_symbol,MODE_BID)," Lots: ",OrderLots()," Ticket: ",OrderTicket());

Print(ErrLog);

}

break;

} // mod

}

}

//----------------------- CLOSE SELL CONDITION

if(STC1_c!=STC2_c)

{

if(OrderType()==OP_SELL)

{

if(STC1_cSTC1_c)

{

bool sellClose= OrderClose(OrderTicket(),OrderLots(),MarketInfo(s_symbol,MODE_ASK),Slippage*pipMultiplier,clCloseSell);

if(sellClose == false)

{

ErrorCode = GetLastError();

ErrDesc = ErrorDescription(ErrorCode);

ErrAlert=StringConcatenate("Close Sell Order - Error ",ErrorCode,": ",ErrDesc);

if(ShowAlerts==true) Alert(ErrAlert);

ErrLog=StringConcatenate("Ask: ",MarketInfo(s_symbol,MODE_ASK)," Lots: ",OrderLots()," Ticket: ",OrderTicket());

Print(ErrLog);

}

break;

} // mod

}

}

}

}

Dans ce code, il n'y a aucun code qui ouvre une position (lafonction OrderSend() n'est pas du tout utilisée).

 
mladen:
D'abord dans l'indicateur TSI supprimer la ligne qui va comme ceci :

#property strict

Avec cette ligne, cela ne fonctionnera pas

______________

Pour le reste : nous devons tous espérer et prier. Avec chaque nouvelle version, le backtesting est de plus en plus lent (voir la plainte de la version 840). Il n'y a pas grand chose à faire. On en est arrivé au point où le backtesting visuel est plus rapide que le backtesting normal (la build 788 est celle que j'utilise) et il n'y a aucune logique dans tout cela.

Merci pour la réponse !

Clair. Je suis dans une ancienne version.

 
mladen:
Dans ce code, il n'y a aucun code qui ouvre une position (la fonction OrderSend() n'est pas du tout utilisée).

Bonjour Mladen,

vous avez raison, veuillez trouver le code ci-dessous qui appelle "OpenSell()".

//+------------------------------------------------------------------+

//| OPEN BUY / OPEN SELL

//+------------------------------------------------------------------+

//----------------------- BUY CONDITION

for(i=OrdersTotal()-1;i>=0; i--)

if(OrderType()==OP_SELL) break;

{

if(STC1!=STC2)

{

/*if(STC1STC1)BUY="true";*/

if(STC1STC1)

/*if((STC115) || (STC185)) // code for buy */

OpenBuy();

return(0);

}

openedOrders++;

}

//----------------------- SELL CONDITION

// if(STC1>STC0&&STC2<STC1)SELL="true";

//if((STC1>15 && STC285 && STC2<85)) // code for sell

if(STC1>STC0&&STC2<STC1) // code for sell

{

OpenSell();

return(0);

}

}

//----------------------- OPEN SELL

void OpenSell()

{

double lsStop = 0; if(sStopLoss>0) lsStop = NormalizeDouble(MarketInfo(s_symbol,MODE_BID)+sStopLoss *pPoint*pipMultiplier,digit);

double lsTake = 0; if(sTakeProfit>0) lsTake = NormalizeDouble(MarketInfo(s_symbol,MODE_BID)-sTakeProfit*pPoint*pipMultiplier,digit);

if(AccountFreeMargin()<(100*Lots)) { Print("We have no money. Free Margin = ",AccountFreeMargin()); return; }

// ECN

if(!EcnBroker)

dummyResult=OrderSend(s_symbol,OP_SELL,LotsOptimized(),MarketInfo(s_symbol,MODE_BID),Slippage*pipMultiplier,lsStop,lsTake,ExpertName,MAGIC,0,clOpenSell);

else

{

int sellTicket = OrderSend(s_symbol,OP_SELL,LotsOptimized(),MarketInfo(s_symbol,MODE_BID),Slippage*pipMultiplier,0,0,ExpertName,MAGIC,0,clOpenSell);

if(sellTicket >= 0)

bool sellOrderMod=OrderModify(sellTicket,OrderOpenPrice(),lsStop,lsTake,0,CLR_NONE);

if(sellOrderMod==false)

{

int ErrorCode = GetLastError();

string ErrDesc = ErrorDescription(ErrorCode);

string ErrAlert=StringConcatenate("Modify Sell Order - Error ",ErrorCode,": ",ErrDesc);

if(ShowAlerts==true) Alert(ErrAlert);

string ErrLog=StringConcatenate("Ask: ",MarketInfo(s_symbol,MODE_ASK)," Bid: ",MarketInfo(s_symbol,MODE_BID)," Ticket: ",sellTicket," Stop: ",lsStop," Profit: ",lsTake);

Print(ErrLog);

}

}

}

 

cher mladen, mrtools j'attends de voir votre réponse à mes questions sur l'indicateur fxultratrend dans le post ci-dessus.

J'espère que vous ne me décevrez pas.

Merci.

Raison: