エラー番号6 - ページ 2

 
<br / translate="no"> チャートの数には制限があります - 99。だから、専門家の数にも制限があるのです。


そうですね、違いますね。私の場合は違います。まず、Expert Advisorの数が99個以下であることです。次に、長時間作業する予定がないこと。1時間以内に再起動し、アラートを出すことです。

では、専門家に見てもらえるか。
 
そして、その熱い思い。もう一人の専門家それがどんな指標であるかは、重要ではありません。重要なのは、同じ通貨で2つの取引が成立していたことです。Expert Advisor のロジックでは、このようなことはできません。論理的に考えれば(チャートを見れば)、前の取引は終了しているはずです。そして、そうならなかった。過去ログには何もない。同じ症状?

上にあげたExpert Advisorの方がいいんじゃないでしょうか。コードの面では、そちらの方がシンプルです。そして、指標もない。

クオーク

// MT4 tested
#include "mylib.mq4"

extern double dBuyLevel;
extern double dSellLevel;
extern double dStopLoss;
extern double dTrailingStop;
extern double dTakeProfit;

extern int nNocInterval;
extern double dNocRange;
extern int nNocMa;

// ------

datetime timePrev = 0;

int nSlip = 5;
double dTp = 0;

double dProfit = 0;
double dInitAmount = 1000;
double dLotSize = 0.1;

int nNumOfExperts = 5;
int nMagic = 0;
bool bReportDone = false;

bool bUseMm = false;

//////////////////
int init ()
{
	if(Symbol() == "EURUSD" && Period() == 60)
	{
		if(!IsTesting())					
		{							// (0.21,0.94,240,40,0.02,3,240), (0.19,0.82,200,30,0.025,5,200)
			dBuyLevel = 0.19;		// (0.21,0.83,160,27,0.026,4,260), (), ()
			dSellLevel = 0.82;
									
			dStopLoss = 230 * Point;		
			dTrailingStop = dStopLoss;
			dTakeProfit = 0;
			
			nNocInterval = 28;
			dNocRange = 0.024;
			nNocMa = 6;
			
			// Max: 0.19,0.82,230,230,0,28,0.024,6; dd: 653, balance: 6900
		}
		else
		{
			dStopLoss = dStopLoss * Point;

			if(dTakeProfit == 700)
				dTakeProfit = 0;			
			dTakeProfit = dTakeProfit * Point;

			dTrailingStop = /*dTrailingStop * Point;*/dStopLoss;
		}

//		bBuy = false;
//		bSell = false;

		nMagic = 10;
	}
	else if(Symbol() == "EURJPY" && Period() == 60)
	{
		if(!IsTesting())					
		{							// (0.17,0.96,120,40,0.01,13)
			dBuyLevel = 0.17;		// balance: 3650, dd: 539
			dSellLevel = 0.96;
											
			dStopLoss = 120 * Point;		
			dTrailingStop = dStopLoss;
			dTakeProfit = 0;
			
			nNocInterval = 40;
			dNocRange = 0.01;
			nNocMa = 13;
		}
		else
		{
			dStopLoss = dStopLoss * Point;

			if(dTakeProfit == 700)
				dTakeProfit = 0;			
			dTakeProfit = dTakeProfit * Point;

			dTrailingStop = /*dTrailingStop * Point;*/ dStopLoss;
		}

//		bBuy = false;
//		bSell = false;

		nMagic = 11;
	}
	else if(Symbol() == "USDCHF" && Period() == 60)
	{
		if(!IsTesting())					
		{									// (0.19,0.82,200,35,0.01,5)
			dBuyLevel = 0.05;				// balance: 6200, dd: 763
			dSellLevel = 0.92;	
											// (0.05,092,250,30,0.025,3)
			dStopLoss = 250 * Point;		// balance: 3600, dd: 500
			dTrailingStop = dStopLoss;
			dTakeProfit = 0;				// (0.07,0.92, 250,40,0.025,9)
											// balance: 3500, dd: 362
			nNocInterval = 30;
			dNocRange = 0.025;				
			nNocMa = 3;						
		}
		else
		{
			dStopLoss = dStopLoss * Point;

			if(dTakeProfit == 700)
				dTakeProfit = 0;			
			dTakeProfit = dTakeProfit * Point;

			dTrailingStop = /*dTrailingStop * Point;*/ dStopLoss;
		}

//		bBuy = false;
//		bSell = false;

		nMagic = 12;
	}
	else if(Symbol() == "GBPUSD" && Period() == 60)
	{
		if(!IsTesting())					
		{									// (0.21,0.84,250,30,0.01,11)	// BUY ONLY: retest!!!
			dBuyLevel = 0.15;				// balance: 6588, dd: 1169
			dSellLevel = 0.84;	
											// (0.15,0.86,250,20,0.025,9)	// BUY ONLY: retest!!!
			dStopLoss = 200 * Point;		// balance: 3337, dd: 552
			dTrailingStop = dStopLoss;
			dTakeProfit = 0;				// (0.15,0.84,200,20,0.025,7)	// buy and sell
											// balance: 4171, dd: 850
			nNocInterval = 20;
			dNocRange = 0.025;				// (0.15,0.88,200,20,0.025,9)	// buy only? retest
			nNocMa = 9;						// balance: 2895, dd: 424
		}
		else
		{
			dStopLoss = dStopLoss * Point;

			if(dTakeProfit == 700)
				dTakeProfit = 0;			
			dTakeProfit = dTakeProfit * Point;

			dTrailingStop = /*dTrailingStop * Point;*/ dStopLoss;
		}

//		bBuy = false;
//		bSell = false;

		nMagic = 13;
	}
	else if(Symbol() == "GBPCHF" && Period() == 60)
	{
		if(!IsTesting())					
		{									// (0.11,0.86,280,20,0.025,7)
			dBuyLevel = 0.11;				// balance: 5564, dd: 777
			dSellLevel = 0.86;	
											// (0.15,0.84,280,25,0.025,11)
			dStopLoss = 280 * Point;		// balance: 4275, dd: 685
			dTrailingStop = dStopLoss;
			dTakeProfit = 0;				// (0.11,0.86,280,25,0.025,9)
											// balance: 4159, dd: 456
			nNocInterval = 25;
			dNocRange = 0.025;				
			nNocMa = 9;						
		}
		else 
		{
			dStopLoss = dStopLoss * Point;

			if(dTakeProfit == 700)
				dTakeProfit = 0;			
			dTakeProfit = dTakeProfit * Point;

			dTrailingStop = /*dTrailingStop * Point;*/ dStopLoss;
		}

//		bBuy = false;
//		bSell = false;

		nMagic = 14;
	}
	else if(Symbol() == "USDJPY" && Period() == 60)
	{
		if(!IsTesting())					
		{									// (0.07,0.82,280,25,0.025,3)
			dBuyLevel = 0.07;				// balance: 3764, dd: 527
			dSellLevel = 0.82;	
											// (0.07,0.8,160,30,0.025,3)
			dStopLoss = 280 * Point;		// balance: 3297, dd: 491
			dTrailingStop = dStopLoss;
			dTakeProfit = 0;				// (0.09, 0.94,280,15,0.025,3)
											// balance: 2703, dd: 541
			nNocInterval = 25;
			dNocRange = 0.025;				
			nNocMa = 3;						
		}
		else 
		{
			dStopLoss = dStopLoss * Point;

			if(dTakeProfit == 700)
				dTakeProfit = 0;			
			dTakeProfit = dTakeProfit * Point;

			dTrailingStop = /*dTrailingStop * Point;*/ dStopLoss;
		}

//		bBuy = false;
//		bSell = false;

		nMagic = 15;
	}
	else if(Symbol() == "AUDUSD" && Period() == 60)
	{
		if(!IsTesting())					
		{									// (0.14,0.9,280,40,0.015,11)
			dBuyLevel = 0.14;				// balance: 3834, dd: 468
			dSellLevel = 0.9;	
											// (0.13,0.92,240,35,0.01,13)
			dStopLoss = 280 * Point;		// balance: 3463, dd: 303
			dTrailingStop = dStopLoss;
			dTakeProfit = 0;				
											
			nNocInterval = 40;
			dNocRange = 0.015;				
			nNocMa = 11;						
		}
		else 
		{
			dStopLoss = dStopLoss * Point;

			if(dTakeProfit == 700)
				dTakeProfit = 0;			
			dTakeProfit = dTakeProfit * Point;

			dTrailingStop = /*dTrailingStop * Point;*/ dStopLoss;
		}

//		bBuy = false;
//		bSell = false;

		nMagic = 16;
	}
	else if(Symbol() == "EURGBP" && Period() == 60)
	{
		if(!IsTesting())					
		{									// (0.09,0.84,200,35,0.01,3)
			dBuyLevel = 0.21;				// balance: 2517, dd: 486
			dSellLevel = 0.82;	
											// (0.21,0.82,280,40,0.015,3)
			dStopLoss = 280 * Point;		// balance: 2726, dd: 324
			dTrailingStop = dStopLoss;
			dTakeProfit = 0;				// (0.21,0.84,160,15,0.01,3)
											// balance: 2255, dd: 314
			nNocInterval = 40;
			dNocRange = 0.015;				
			nNocMa = 3;						
		}
		else 
		{
			dStopLoss = dStopLoss * Point;

			if(dTakeProfit == 700)
				dTakeProfit = 0;			
			dTakeProfit = dTakeProfit * Point;

			dTrailingStop = dStopLoss;
		}

//		bBuy = false;
//		bSell = false;

		nMagic = 17;
	}
	else if(Symbol() == "USDCAD" && Period() == 60)
	{
		if(!IsTesting())					
		{									// (0.05,0.88,280,25,0.015,7)
			dBuyLevel = 0.07;				// balance: 3536, dd: 235
			dSellLevel = 0.86;	
											// (0.07,0.86,280,15,0.015,3)
			dStopLoss = 280 * Point;		// balance: 3414, dd: 380
			dTrailingStop = dStopLoss;
			dTakeProfit = 0;				
											
			nNocInterval = 15;
			dNocRange = 0.015;				
			nNocMa = 3;						
		}
		else 
		{
			dStopLoss = dStopLoss * Point;

			if(dTakeProfit == 700)
				dTakeProfit = 0;			
			dTakeProfit = dTakeProfit * Point;

			dTrailingStop = dStopLoss;
		}

//		bBuy = false;
//		bSell = false;

		nMagic = 18;
	}
	else if(Symbol() == "EURCHF" && Period() == 60)
	{
		if(!IsTesting())					
		{									// (0.17,0.84,280,15,0.01,5)
			dBuyLevel = 0.17;				// balance: 1471, dd: 221
			dSellLevel = 0.84;	
											// (0.17,0.88,200,15,0.01,5)
			dStopLoss = 200 * Point;		// balance: 1433, dd: 135
			dTrailingStop = dStopLoss;
			dTakeProfit = 0;				
											
			nNocInterval = 15;
			dNocRange = 0.01;				
			nNocMa = 5;						
		}
		else 
		{
			dStopLoss = dStopLoss * Point;

			if(dTakeProfit == 700)
				dTakeProfit = 0;			
			dTakeProfit = dTakeProfit * Point;

			dTrailingStop = dStopLoss;
		}

//		bBuy = false;
//		bSell = false;

		nMagic = 19;
	}
	else if(Symbol() == "EURAUD" && Period() == 60)
	{
		if(!IsTesting())					
		{									// (0.05,0.8,240,30,0.025,9)
			dBuyLevel = 0.05;				// balance: , dd: 
			dSellLevel = 0.8;	
											// ()
			dStopLoss = 240 * Point;		// balance: , dd: 
			dTrailingStop = dStopLoss;
			dTakeProfit = 0;				
											
			nNocInterval = 30;
			dNocRange = 0.025;				
			nNocMa = 9;						
		}
		else 
		{
			dStopLoss = dStopLoss * Point;

			if(dTakeProfit == 700)
				dTakeProfit = 0;			
			dTakeProfit = dTakeProfit * Point;

			dTrailingStop = dStopLoss;
		}

//		bBuy = false;
//		bSell = false;

		nMagic = 20;
	}

	return(0);
}
// ------
int deinit()
{
	return(0);
}

// ------

int start()
{
	if(Bars < nNocInterval + nNocMa)
		return(0);
	
	Report("Noc_1", nMagic, bReportDone);

	// The previous bar just closed
	bool bIsBarEnd = false;
	if(timePrev != Time[0]) 
		bIsBarEnd = true;
	timePrev = Time[0];
	
	if(!bIsBarEnd)
		return(0);
	
	// ------
	
	double dNoc = iCustom(NULL, 0, "_Noc_Ind", nNocInterval, dNocRange, nNocMa, 0, 1);
	double dNocPrev = iCustom(NULL, 0, "_Noc_Ind", nNocInterval, dNocRange, nNocMa, 0, 2);
		
	int nNumOfOpenedOrders = 0;
	for(int nCnt = 0; nCnt < OrdersTotal(); nCnt++)
	{
		OrderSelect(nCnt, SELECT_BY_POS, MODE_TRADES);
		if(OrderMagicNumber() == nMagic)
		{
			if(OrderType() <= OP_SELL)
				nNumOfOpenedOrders++;
		}
	}

	if(bUseMm == true)
	{
		dProfit = 0;
		
		for(nCnt = 0; nCnt < HistoryTotal(); nCnt++)
		{
			OrderSelect(nCnt, SELECT_BY_POS, MODE_HISTORY);
			if(OrderMagicNumber() == nMagic && OrderType() <= OP_SELL)
			{
				dProfit += OrderProfit();
			}
		}   
 	}
 	
	if(nNumOfOpenedOrders == 0)
	{
		if(dNocPrev <= dBuyLevel && dNoc >= dBuyLevel) 
			Buy();
		else if(dNocPrev >= dSellLevel && dNoc <= dSellLevel) 
			Sell();
		
		return(0);
	}
	else
	{
		for(nCnt = 0; nCnt < OrdersTotal(); nCnt++)
		{
			OrderSelect(nCnt, SELECT_BY_POS, MODE_TRADES);
			if(OrderMagicNumber() == nMagic)
			{
				if(OrderType() == OP_BUY)
				{         
					if(dNocPrev >= dSellLevel && dNoc <= dSellLevel)
					{
						OrderClose(OrderTicket(), OrderLots(), Bid, nSlip, Aqua);

						Sell();

						return(0);
					}
				}
				else if(OrderType() == OP_SELL)
				{
        			if(dNocPrev <= dBuyLevel && dNoc >= dBuyLevel)
					{
						OrderClose(OrderTicket(), OrderLots(), Ask, nSlip, OrangeRed);

						Buy();

						return(0);
					}
				}
			}
		}
	}
	
	// ------
	
	for(nCnt = 0; nCnt < OrdersTotal(); nCnt++)
	{
		OrderSelect(nCnt, SELECT_BY_POS, MODE_TRADES);
		if(OrderMagicNumber() == nMagic && OrderSymbol() == Symbol())
		{
			if(OrderType() == OP_BUY)// && Bid - OrderOpenPrice() > dStopLoss) 
			{
				if(OrderStopLoss() < Bid - dTrailingStop - 5 * Point)
				{
					OrderModify(OrderTicket(), OrderOpenPrice(), 
						Bid - dTrailingStop, OrderTakeProfit(), 0, Aqua);

					return(0);
				}
			}
			
			if(OrderType() == OP_SELL)// && OrderOpenPrice() - Ask > dStopLoss)
			{
				if(OrderStopLoss() > Ask + dTrailingStop + 5 * Point)// || OrderStopLoss() == 0)
				{
					OrderModify(OrderTicket(), OrderOpenPrice(), 
						Ask + dTrailingStop, OrderTakeProfit(), 0, OrangeRed);

					return(0);
				}
			}
		}
	}
	
	return(0);
}

// ------

void Sell()
{
	if(AccountFreeMargin() < 500)
		return;

	dLotSize = GetLotSize();

	if(dTakeProfit == 0)
		dTp = 0;
	else
		dTp = Bid - dTakeProfit;

	OrderSend(Symbol(), OP_SELL, dLotSize, Bid, nSlip, Bid + dStopLoss, 
		dTp, "Noc_1", nMagic, 0, OrangeRed);

}

// ------

void Buy()
{
	if(AccountFreeMargin() < 500)
		return;

	dLotSize = GetLotSize();

	if(dTakeProfit == 0)
		dTp = 0;
	else
		dTp = Ask + dTakeProfit;

	OrderSend(Symbol(), OP_BUY, dLotSize, Ask, nSlip, Ask - dStopLoss, 
		dTp, "Noc_1", nMagic, 0, Aqua);
}
// ------
double GetLotSize()
{
	double dLot = 0.1;
	
	if(bUseMm)
	{
		dLot  = (0.1 * dInitAmount + 0.2 * dProfit) / 1000;

		if(dLot * 2 * dInitAmount > AccountFreeMargin() / nNumOfExperts)
			dLot = AccountFreeMargin() / (2 * dInitAmount * nNumOfExperts);

		dLot = MathFloor(dLot * 10) / 10;
	
		if(dLot < 0.1)
			dLot = 0.1;
	}
	
	return(dLot);
}

// ------


 
1つの口座に9つのEAを入れて2ヶ月が経ちました。そのような構造を全てに実装しています。
ticket=OrderSend(Symbol(,OP_SELL,Lots,Bid,Slippage,Bid+StopLoss*Point,Bid-TakeProfit*Point, "sell",ExpertMagicNumber,0,Red); if(ticket<0) { Print("OrderSend failed with error #",GetLastError()); return(0); }; }; if(ticket(0))で終了。



ログがきれいになり、注文が入る。

 
1つのアカウントで9つのEAを2ヶ月間使っています。すべて同じ構造です:<br/ translate="no">
ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,Slippage,Bid+StopLoss*Point,Bid-TakeProfit*Point, "sell",ExpertMagicNumber,0,Red); if(ticket<0) { Print("OrderSend failed with error #",GetLastError()); return(0); }



ログがきれいになり、注文が入る。



なんて言ったらいいんだろう。最初に引用した私のExpert Advisorを試してみてください。1時間に1回の取引を行います。通常、2回目の取引では、エラーメッセージが 表示されます。24時間以内にエラーが出なければ、それすらもわからない...。
 
10分後に何かするらしいので、電話を切りました。他のEAを壊されないといいのですが。Yo000、すでに注文を開けている。1時間ごとの約束で、まだ1分も経っていないぞ。
 
10分後に何かするらしいので、電話を切りました。他のEAを壊されないといいのですが。Yo000、すでに注文を開けている。1時間ごとの約束で、まだ1分も経っていないぞ。


初回は一気に注文を開く(バーの先頭で条件を確認するを参照)。そして、触らなければ、次の時間の始めに
 
さて、サーカスは続く。2人目の専門家にAlertを掛けた。時間目には2つのカーブが交差することが予想され、彼は素直に注文を開こうとした。その代わり、エラー番号6が出た。開発者の皆さん?
 
ロッシュ、聞いてくれ、もちろん感謝してる。しかし、私のEAはマジックナンバーで「その」取引を追跡していることに疑問を感じました。もし考え方が同じなら(EAによって意見は違いますが)、他の人の注文を閉じないようにしたいです。もしアプローチが同じ(各EAが独自のmnを持つ)なら、このEAのmnがあなたのものと重ならないようにする必要があります。
 
この種の投稿を読むと、とても悲しくなり、何か言いたくなるので、洪水を書いています。特に、もう何杯か飲んでしまったので...。

ぜひとも、専門家であるクオークに失敗してほしいものです。パソコンから離れたPDAから書いているので、まだ自分では確認できません。しかし、MTであれば、ファ...、しかし、フサース沈黙!?
 
本当に静かです :)
理由: