Aiuto per la codifica - pagina 490

 
tfi_markets:
Attuare; indicatore NonLag_Schaff_TrendCycle:

Ciao Pro-Coders,

Mi chiedo qualcuno potrebbe aiutarmi nell'implementazione dell'indicatore NonLag_Schaff_TrendCycle.

Esterni dell'indicatore:

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;

Buffer dell'indicatore:

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);

Provo a fare qualcosa come

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);

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

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

Ma ottengo un messaggio di errore

Errore: NonLag_Schaff_TrendCycle è stato rimosso.

Credo di aver letto male i buffer. Qualcuno ha un suggerimento?

Grazie in anticipo!

Il primo parametro di nonlag schaf trend cycle è "TimeFrame". Ti manca nella chiamata iCustom. La chiamata iCustom() dovrebbe essere come questa:

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

 

Bisogno di aiuto

Ciao mladen

grazie per i tuoi aiuti passati

ho provato a fare questo indicatore ma non appare

quindi pls aiutami ancora

Grazie in anticipo

mtf_rsi_candle_all_in_one.mq4

 

Ciao Mladen,

grazie mille per il tuo aiuto. Ora funziona

Con cordiali saluti,

Thomas

mladen:
Il primo parametro del ciclo di tendenza nonlag schaf è "TimeFrame". Manca nella chiamata iCustom. La chiamata iCustom() dovrebbe essere come questa: iCustom(Symbol(),0, "NonLag_Schaff_TrendCycle","",FastLength,SlowLength,StcPeriod,MacdPrice,Interpolate,0,bar);
 

Ciao, Mladen!

Quando la nuova build lunga fa l'ottimizzazione.

Se si ritorna alla build 670, la velocità di ottimizzazione è buona.

Quale potrebbe essere il problema?

experttsi.mq4

tsi.mq4

File:
experttsi.mq4  2 kb
tsi.mq4  4 kb
 
QuantF:
Ciao, Mladen!

Quando la nuova build lunga fa l'ottimizzazione.

Se si ritorna alla build 670, la velocità di ottimizzazione è buona.

Quale potrebbe essere il problema?

experttsi.mq4

tsi.mq4

Firs in indicatore TSI eliminare la linea che va come questo :

#proprietà rigorosa

Con quella linea non funzionerà

______________

Per il resto: dobbiamo tutti sperare e pregare. Con ogni nuova build, il backtesting è sempre più lento, sempre più lento (vedi la denuncia della build 840). Non c'è molto da fare. Si è arrivati al punto che il visual back testin è più veloce del backtesting regolare (la build 788 è quella che sto usando) e non c'è alcuna logica in esso

 

Ciao Pro Coders,

per qualche motivo il mio EA chiude le posizioni ma non ne apre di nuove, dopo che il trend è cambiato. Qualcuno potrebbe gentilmente dare un'occhiata?

Grazie in anticipo!

//----------------------- 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

}

}

}

}

File:
trendcycle.jpg  97 kb
 
tfi_markets:
Ciao Pro Coders,

per qualche motivo il mio EA chiude le posizioni ma non ne apre di nuove, dopo che il trend è cambiato. Qualcuno potrebbe gentilmente dare un'occhiata?

Grazie in anticipo!

//----------------------- 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

}

}

}

}

In quel codice non c'è nessun codice che possa aprire una posizione(la funzione OrderSend() non è usata affatto)

 
mladen:
Prima nell'indicatore TSI cancella la linea che fa così:

#proprietà rigorosa

Con quella linea non funzionerà

______________

Per il resto: dobbiamo tutti sperare e pregare. Con ogni nuova build, il backtesting è sempre più lento (vedi la denuncia della build 840). Non c'è molto da fare. Si è arrivati al punto che il visual back testin è più veloce del backtesting regolare (la build 788 è quella che sto usando) e non c'è alcuna logica in esso

Grazie per la risposta!

Chiaro. Rimango in una vecchia build.

 
mladen:
In quel codice non c'è nessun codice che aprirebbe una posizione (la funzione OrderSend() non è usata affatto)

Ciao Mladen,

hai ragione, trova il codice qui sotto che chiama "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);

}

}

}

 

caro mladen, mrtools in attesa di vedere la tua risposta per le mie domande di indicatore fxultratrend in post sopra.

spero che non mi deluderai.

Grazie.

Motivazione: