编码帮助 - 页 490

 
tfi_markets:
实施;NonLag_Schaff_TrendCycle指标

嗨,专业编码人员。

我想知道谁能帮助我实现NonLag_Schaff_TrendCycle指标。

指标外设。

extern int FastLength = 23;

外置 int SlowLength = 50;

extern int StcPeriod = 10;

Extern int MacdPrice = PRICE_CLOSE;

外部 bool Interpolate = true;

外部 bool MultiColor = true。

指标缓冲区。

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

我尝试做一些事情,比如

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

如果((STC1_c>15 && STC2_c85 && STC2_c BUY)

如果((STC1_c15)||(STC1_c85)->卖出

但我得到一个错误信息。

错误。NonLag_Schaff_TrendCycle已被删除。

我想我可能读错了缓冲区。有谁有建议吗?

提前感谢您!

Nonlag Schaf趋势周期的第一个参数 是 "TimeFrame"。你在iCustom调用中缺少它。iCustom()的调用应该是这样的。

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

 

需要帮助

你好mladen

感谢你过去的帮助

我试着做了这个指标,但它没有出现。

所以请再次帮助我

谢谢你

mtf_rsi_candle_all_in_one.mq4

附加的文件:
 

嗨,Mladen。

非常感谢您的帮助。现在它已经开始工作了

致以诚挚的问候。

托马斯

mladen:
nonlag schaf趋势周期的第一个参数是 "TimeFrame"。你在iCustom调用中缺少这个参数。iCustom()的调用应该是这样的:iCustom(Symbol(),0, "NonLag_Schaff_TrendCycle","",FastLength,SlowLength,StcPeriod,MacdPrice,Interpolate,0,bar)。
 

你好,Mladen!

当新的构建长进行优化。

如果返回到670版本,优化速度就很好。

可能是什么问题?

专家tsi.mq4

tsi.mq4

附加的文件:
experttsi.mq4  2 kb
tsi.mq4  4 kb
 
QuantF:
嗨,Mladen!

当新的构建长进行优化。

如果返回到670版本,优化速度就很好。

这可能是什么问题?

experttsi.mq4

tsi.mq4

首先,在TSI指标中删除这样的一行。

#property strict

有了这一行,它就不能工作了

______________

至于其他的:我们都应该希望和祈祷。随着每一次新版本的建立,回测的速度越来越慢(见对版本840的投诉)。没有什么可做的。现在已经到了视觉回测比常规回测快的地步了(我使用的是Build 788),而且其中根本没有逻辑。

 

嗨,专业编纂者。

由于某些原因,我的EA在趋势改变后关闭了头寸,但没有开设新的头寸。谁能看一下?

谢谢您的帮助。

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

}

}

}

}

附加的文件:
trendcycle.jpg  97 kb
 
tfi_markets:
嗨,专业编纂者。

由于某些原因,我的EA在趋势改变后关闭了头寸,但没有开设新的头寸。谁能看一下?

谢谢您的帮助。

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

}

}

}

}

在这段代码中,根本没有开仓的代码 其中根本没有使用OrderSend()函数)

 
mladen:
首先,在TSI指标中删除这样的一行。

#property strict

有了这一行,它将无法工作

______________

至于其他的:我们都应该希望和祈祷。每一个新的版本,回测的速度都越来越慢,越来越慢(见对版本840的抱怨)。没有什么可做的。现在的情况是,视觉回测比常规回测更快(我使用的是788版本),而且其中根本没有逻辑。

谢谢你的回答!

清除。我停留在一个旧版本中。

 
mladen:
在这段代码中,根本没有开仓的代码(其中根本没有使用OrderSend()函数)

Hi Mladen,

你是对的,请看下面调用 "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);

}

}

}

 

亲爱的Mladen, mrtools等着看你对我在上面的帖子中关于fxultratrend指标的询问的答复。

希望你不会让我失望。

谢谢。