실수 번호 6 - 페이지 2

 

차트 수에는 제한이 있습니다 - 99. 전문가 수에도 동일한 제한이 있음을 의미합니다.


음 ... 아니. 제 경우가 아닙니다. 첫째, 99명 미만의 전문가 고문이 있습니다. 둘째, 긴 작업에 대한 질문이 없습니다. 다시 시작하고 1시간 이내에 경고가 표시됩니다.

그럼 전문가를 만나볼까요?
 
글쎄, 뜨거운 추적에서. 또 다른 전문가. 지표가 무엇인지는 중요하지 않습니다. 의미심장하게도, 나는 그가 같은 통화로 두 개의 거래를 열었다는 것을 발견했습니다. EA의 논리는 이것을 허용하지 않습니다. 논리적으로(차트를 보면) 이전 거래가 마감되어야 합니다. 그리고 닫히지 않았습니다. 로그에 아무것도 없습니다. 같은 증상?

물론 위에서 언급한 전문가를 살펴보는 것이 좋습니다. 코드 측면에서 모든 것이 더 간단합니다. 그리고 지표가 없습니다.

쿼크.

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

// ------


 
2개월 동안 한 계정에 9명의 전문가 고문이 있었습니다. 모두 비슷한 디자인을 가지고 있습니다.
 ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,Slippage,Bid+StopLoss*Point,Bid-TakeProfit*Point,"판매",ExpertMagicNumber,0,Red);
                  if(티켓<0)
                     {
                     Print("오류 번호로 인해 OrderSend가 실패했습니다.",GetLastError());
                     리턴(0);
                     }



통나무가 깨끗하고 주문이 들어갑니다.

 
2개월 동안 한 계정에 9명의 전문가 고문이 있었습니다. 모두 비슷한 디자인을 가지고 있습니다.
 ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,Slippage,Bid+StopLoss*Point,Bid-TakeProfit*Point,"판매",ExpertMagicNumber,0,Red);
                  if(티켓<0)
                     {
                     Print("오류 번호로 인해 OrderSend가 실패했습니다.",GetLastError());
                     리턴(0);
                     }



통나무가 깨끗하고 주문이 들어갑니다.



글쎄, 내가 무엇을 말할 수 있습니까? 내가 먼저 준 Expert Advisor를 사용해보십시오. 그는 시간당 하나의 거래를 제공합니다. 일반적으로 두 번째 트랜잭션 은 오류 메시지를 나타냅니다. 하루에 오류가 없으면 나도 모르게...
 
전화를 끊고 10분 안에 뭔가를 해야 할 것 같습니다. 그가 나를 위해 다른 조언자들을 망치지 않기를 바랍니다. E000, 그는 이미 주문을 열었습니다. 매시간 약속했지만 1분이 지나지 않았습니다.
 
전화를 끊고 10분 안에 뭔가를 해야 할 것 같습니다. 그가 나를 위해 다른 조언자들을 망치지 않기를 바랍니다. Ё000, 그는 이미 주문을 열었습니다. 매시간 약속했지만 여기에서는 1분이 지나지 않았습니다.


처음으로 즉시 주문을 엽니다(막대 시작 부분의 조건 확인 참조). 그런 다음 만지지 않으면 흔적의 시작 부분에 있습니다. 시간.
 
자, 서커스는 계속됩니다. 두 번째 전문가에 대한 경고 중단. 시초에는 두 곡선의 교차점이 예상돼 정직하게 오더를 열려고 했다. 대신 - 오류 번호 6. 여러분, 개발자 여러분?
 
로쉬, 들어요. 물론 도와주셔서 감사합니다. 하지만 여기서 내 고문은 "그" 거래를 마법의 숫자로 추적한다고 생각했습니다. 이 접근 방식이 사용 중인 것과 호환되는지 주의 깊게 살펴보십시오. 그렇지 않으면 다른 사람의 주문이 실제로 종료되지 않습니다. 동일한 접근 방식(각 전문가마다 고유한 mn이 있음)이 있는 경우 이 전문가의 mn이 귀하의 것과 교차하지 않는지 확인해야 합니다.
 
Flud 쓰기, tk. 그런 글을 읽으면 너무 슬퍼지고 할 말이 필요합니다. 특히 이미 안경을 몇 개 굴렸기 때문에 ...

나는 그의 Expert Advisor를 망친 것이 Quark이기를 정말로 바랍니다. 아직 직접 확인할 수는 없고, 컴퓨터와 떨어져 PDA로 글을 쓰고 있습니다. 그러나 이것이 MT라면 씨발 ... 그러나 hussars는 침묵합니다!
 
정말 조용히 :)
사유: