초보자의 질문 MQL4 MT4 MetaTrader 4 - 페이지 35

 

안녕하세요!
표시기를 수정하려면 모든 점 "."을 교체해야 했습니다. ""를 비우십시오.

파일:
supDem.zip  68 kb
 

인사말.

주문 선택 기능에서 특정 주문을 카운팅하는 작성 기능에서 선택 유형을 주문 선택에서 티켓 선택으로 변경했습니다.

int  BuyLimitCount(){
int  count= 0
for ( int  i= OrdersTotal ()- 1 ; i>= 0 ; i--){
if ( OrderSelect (i,  SELECT_BY_POSMODE_TRADES )== true ){
if ( OrderMagicNumber ()==MagicB){
if ( OrderType ()== OP_BUYLIMIT )
count++;}}} return (count);}  

int  BuyLimitCount(){
int  count= 0
if ( OrderSelect (ticketUP,  SELECT_BY_TICKETMODE_TRADES )== true ){
if ( OrderMagicNumber ()==MagicB){
if ( OrderType ()== OP_BUYLIMIT )
count++;}} return (count);}

그 후 수십 개의 양초를 시작하면 모든 것이 올바르게 해결되고 다음 오류가 로그로 이동하여 반복됩니다.

2016.12.17 17:44:31.609 2016.12.07 00:27 test3 EURUSD,M1: OrderModify 기능에 대한 알 수 없는 티켓 2

2016.12.17 17:44:31.608 2016.12.07 00:25 test3 EURUSD,M1: OrderModify 오류 4108 // 잘못된 티켓 번호입니다.

다음은 네 가지 기능 모두에서 그에 따라 변경된 전체 텍스트입니다.

extern   int  pointsl= 100 , pointtp= 100 , MagicB= 1111 , MagicS= 2222 , bars= 10 ;   extern   double  lotB= 0.1 , lotS= 0.1 ;
double  slB, tpB, slS, tpS;   double  x= 0 , z= 0int  ticketUP, ticketD;


void   OnTick ()  
{
double  maxpr1=- 9999double  minpr1= 9999 ;

for ( int  shift1= 0 ; shift1<bars; shift1++)
{ double  i= iHigh ( Symbol (),  PERIOD_CURRENT , shift1);
if  (i>maxpr1){maxpr1=i;}}

for ( int  shiftA1= 0 ; shiftA1<bars; shiftA1++)
{ double  y= iLow ( Symbol (),  PERIOD_CURRENT , shiftA1);
if  (y<minpr1) {minpr1=y;}} 

if  (BuyLimitCount()== 0  && BuyCount()== 0 ){
slB= NormalizeDouble (minpr1-pointsl* Point , 5 );
tpB= NormalizeDouble (minpr1+pointtp* Point , 5 );
ticketUP= OrderSend ( Symbol (),  OP_BUYLIMIT , lotB, minpr1,  3 , slB, tpB,  "" , MagicB,  0 , Red);
if  (ticketUP==- 1Print ( "ERROR OP_BUY" );  else   Print ( "OP_BUY OK" );}

if  (SellLimitCount()== 0  && SellCount() == 0 ){
slS= NormalizeDouble (maxpr1+pointsl* Point , 5 );
tpS= NormalizeDouble (maxpr1-pointtp* Point , 5 );
ticketD= OrderSend ( Symbol (),  OP_SELLLIMIT , lotS, maxpr1,  3 , slS, tpS,  "" , MagicS,  0 , Blue);
if  (ticketD==- 1Print ( "ERROR OP_SELL" );  else   Print ( "OP_SELL OK" );}

if  (x!=maxpr1){x=maxpr1;
slS= NormalizeDouble (maxpr1+pointsl* Point , 5 );
tpS= NormalizeDouble (maxpr1-pointtp* Point , 5 );
OrderModify (ticketD, maxpr1, slS, tpS,  0 , Blue);}

if  (z!=minpr1){z=minpr1;
slB= NormalizeDouble (minpr1-pointsl* Point , 5 );
tpB= NormalizeDouble (minpr1+pointtp* Point , 5 );
OrderModify (ticketUP, minpr1, slB, tpB,  0 , Red);}

double  maxpr=- 9999double  minpr= 9999 ;

for ( int  shift= 0 ; shift<bars; shift++)
{ double  e= iHigh ( Symbol (),  PERIOD_CURRENT , shift);
if  (e>maxpr){maxpr=e;}}

for ( int  shiftA= 0 ; shiftA<bars; shiftA++)
{ double  r= iLow ( Symbol (),  PERIOD_CURRENT , shiftA);
if  (r<minpr) {minpr=r;}} 

string  a;
if (bars== 1 )a= "bar: " ;
else  a=  IntegerToString (bars, 1 ) +  " bar's: " ;
Comment ( "Last " , a,  "max "DoubleToStr (maxpr,  5 ),  ", min "DoubleToStr (minpr,  5 ), "." );
}

int  BuyLimitCount(){
int  count= 0
if ( OrderSelect (ticketUP,  SELECT_BY_TICKETMODE_TRADES )== true ){
if ( OrderMagicNumber ()==MagicB){
if ( OrderType ()== OP_BUYLIMIT )
count++;}} return (count);}

int  BuyCount(){
int  count= 0
if ( OrderSelect (ticketUP,  SELECT_BY_TICKETMODE_TRADES )== true ){
if ( OrderMagicNumber ()==MagicB){
if ( OrderType ()== OP_BUY )
count++;}} return (count);}

int  SellLimitCount(){
int  count= 0
if ( OrderSelect (ticketD,  SELECT_BY_TICKETMODE_TRADES )== true ){
if ( OrderMagicNumber ()==MagicS){
if ( OrderType ()== OP_SELLLIMIT )
count++;}} return (count);}

int  SellCount(){
int  count= 0
if ( OrderSelect (ticketD,  SELECT_BY_TICKETMODE_TRADES )== true ){
if ( OrderMagicNumber ()==MagicS){
if ( OrderType ()== OP_SELL )
count++;}} return (count);}


그리고 한 가지 포인트가 있습니다. 선택 기능을 변경한 후 주문 수정 기능에서 오류가 발생하기 시작했고 테스트 시작 후 얼마 지나지 않아 처음에는 모든 것이 정상이었습니다.

왜 이런 일이 일어나고 어떻게 대처해야 합니까?


 
spoiltboy :

인사말.

주문 선택 기능에서 특정 주문을 카운팅하는 작성 기능에서 선택 유형을 주문 선택에서 티켓 선택으로 변경했습니다.

int  BuyLimitCount(){
int  count= 0
for ( int  i= OrdersTotal ()- 1 ; i>= 0 ; i--){
if ( OrderSelect (i,  SELECT_BY_POSMODE_TRADES )== true ){
if ( OrderMagicNumber ()==MagicB){
if ( OrderType ()== OP_BUYLIMIT )
count++;}}} return (count);}  

int  BuyLimitCount(){
int  count= 0
if ( OrderSelect (ticketUP,  SELECT_BY_TICKETMODE_TRADES )== true ){
if ( OrderMagicNumber ()==MagicB){
if ( OrderType ()== OP_BUYLIMIT )
count++;}} return (count);}

그 후 수십 개의 양초를 시작하면 모든 것이 올바르게 해결되고 다음 오류가 로그로 이동하여 반복됩니다.

2016.12.17 17:44:31.609 2016.12.07 00:27 test3 EURUSD,M1: OrderModify 기능에 대한 알 수 없는 티켓 2

2016.12.17 17:44:31.608 2016.12.07 00:25 test3 EURUSD,M1: OrderModify 오류 4108 // 잘못된 티켓 번호입니다.

다음은 네 가지 기능 모두에서 그에 따라 변경된 전체 텍스트입니다.

extern   int  pointsl= 100 , pointtp= 100 , MagicB= 1111 , MagicS= 2222 , bars= 10 ;   extern   double  lotB= 0.1 , lotS= 0.1 ;
double  slB, tpB, slS, tpS;   double  x= 0 , z= 0int  ticketUP, ticketD;


void   OnTick ()  
{
double  maxpr1=- 9999double  minpr1= 9999 ;

for ( int  shift1= 0 ; shift1<bars; shift1++)
{ double  i= iHigh ( Symbol (),  PERIOD_CURRENT , shift1);
if  (i>maxpr1){maxpr1=i;}}

for ( int  shiftA1= 0 ; shiftA1<bars; shiftA1++)
{ double  y= iLow ( Symbol (),  PERIOD_CURRENT , shiftA1);
if  (y<minpr1) {minpr1=y;}} 

if  (BuyLimitCount()== 0  && BuyCount()== 0 ){
slB= NormalizeDouble (minpr1-pointsl* Point , 5 );
tpB= NormalizeDouble (minpr1+pointtp* Point , 5 );
ticketUP= OrderSend ( Symbol (),  OP_BUYLIMIT , lotB, minpr1,  3 , slB, tpB,  "" , MagicB,  0 , Red);
if  (ticketUP==- 1Print ( "ERROR OP_BUY" );  else   Print ( "OP_BUY OK" );}

if  (SellLimitCount()== 0  && SellCount() == 0 ){
slS= NormalizeDouble (maxpr1+pointsl* Point , 5 );
tpS= NormalizeDouble (maxpr1-pointtp* Point , 5 );
ticketD= OrderSend ( Symbol (),  OP_SELLLIMIT , lotS, maxpr1,  3 , slS, tpS,  "" , MagicS,  0 , Blue);
if  (ticketD==- 1Print ( "ERROR OP_SELL" );  else   Print ( "OP_SELL OK" );}

if  (x!=maxpr1){x=maxpr1;
slS= NormalizeDouble (maxpr1+pointsl* Point , 5 );
tpS= NormalizeDouble (maxpr1-pointtp* Point , 5 );
OrderModify (ticketD, maxpr1, slS, tpS,  0 , Blue);}

if  (z!=minpr1){z=minpr1;
slB= NormalizeDouble (minpr1-pointsl* Point , 5 );
tpB= NormalizeDouble (minpr1+pointtp* Point , 5 );
OrderModify (ticketUP, minpr1, slB, tpB,  0 , Red);}

double  maxpr=- 9999double  minpr= 9999 ;

for ( int  shift= 0 ; shift<bars; shift++)
{ double  e= iHigh ( Symbol (),  PERIOD_CURRENT , shift);
if  (e>maxpr){maxpr=e;}}

for ( int  shiftA= 0 ; shiftA<bars; shiftA++)
{ double  r= iLow ( Symbol (),  PERIOD_CURRENT , shiftA);
if  (r<minpr) {minpr=r;}} 

string  a;
if (bars== 1 )a= "bar: " ;
else  a=  IntegerToString (bars, 1 ) +  " bar's: " ;
Comment ( "Last " , a,  "max "DoubleToStr (maxpr,  5 ),  ", min "DoubleToStr (minpr,  5 ), "." );
}

int  BuyLimitCount(){
int  count= 0
if ( OrderSelect (ticketUP,  SELECT_BY_TICKETMODE_TRADES )== true ){
if ( OrderMagicNumber ()==MagicB){
if ( OrderType ()== OP_BUYLIMIT )
count++;}} return (count);}

int  BuyCount(){
int  count= 0
if ( OrderSelect (ticketUP,  SELECT_BY_TICKETMODE_TRADES )== true ){
if ( OrderMagicNumber ()==MagicB){
if ( OrderType ()== OP_BUY )
count++;}} return (count);}

int  SellLimitCount(){
int  count= 0
if ( OrderSelect (ticketD,  SELECT_BY_TICKETMODE_TRADES )== true ){
if ( OrderMagicNumber ()==MagicS){
if ( OrderType ()== OP_SELLLIMIT )
count++;}} return (count);}

int  SellCount(){
int  count= 0
if ( OrderSelect (ticketD,  SELECT_BY_TICKETMODE_TRADES )== true ){
if ( OrderMagicNumber ()==MagicS){
if ( OrderType ()== OP_SELL )
count++;}} return (count);}


그리고 한 가지 포인트가 있습니다. 선택 기능을 변경한 후 주문 수정 기능에서 오류가 발생하기 시작했고 테스트 시작 후 얼마 지나지 않아 처음에는 모든 것이 정상이었습니다.

왜 이런 일이 일어나고 어떻게 대처해야 합니까?


이미 작동했거나 제거된 지연기를 수정하려고 하기 때문에 이 오류가 발생했을 가능성이 큽니다. 예를 들어, 보류 주문이 발생했을 때 보류 티켓이 저장된 변수를 재설정해야 합니다.
 
Sergey Gritsay :
이미 작동했거나 제거된 지연기를 수정하려고 하기 때문에 이 오류가 발생했을 가능성이 큽니다. 예를 들어, 보류 주문이 발생했을 때 보류 티켓이 저장된 변수를 재설정해야 합니다.
어떻게 해야 제대로 되는지 알려주실 수 있나요? 그리고 나서 뭔가가 작동하지 않습니다.
 

안녕하세요 여러분, 무엇이 잘못되었는지 알아내도록 도와주세요.

EA가 주문 티켓을 엽니다=OrderSend(Symbol(),OP_BUY,Lot,Ask,3,0,0,"AV2",1111,0,Green);

MT4 닫기, MT4 열기, 어드바이저의 이전 작업 확인 중

for(int prev=0; prev< OrdersTotal() ;prev++) //EA의 이전 작업 확인

{

ViborOrdera=주문 선택(이전,SELECT_BY_POS);

if(OrderSymbol()==Symbol())

//****************************************

//-------구매주기 확인--------

if (OrderType()==OP_BUY && OrderMagicNumber()==1111)

{

PriceAsk=OrderOpenPrice();//공개 가격, EA의 추가 작업에 필요

}

문제는 오류가 어디에 있는지 확인하는 것입니다. 루프가 입력되지 않습니다. 루프 본문은 Init에 있습니다.

 

이해할 시간이 없다...........

읽고 올바른 위치에 넣으십시오.

bool RefreshRates ();

///
 
ed3sss :

안녕하세요 여러분, 무엇이 잘못되었는지 알아내도록 도와주세요.

EA가 주문 티켓을 엽니다=OrderSend(Symbol(),OP_BUY,Lot,Ask,3,0,0,"AV2",1111,0,Green);

MT4 닫기, MT4 열기, 어드바이저의 이전 작업 확인 중


문제는 오류가 어디에 있는지 확인하는 것입니다. 루프가 입력되지 않습니다. 루프 본문은 Init에 있습니다.

그리고 정확히 사이클에 들어가지 않는 것을 증명하십시오. 게다가 최신 주문이 필요한 경우 계정 수명의 맨 처음부터 모든 주문을 확인하는 이유는 무엇입니까???
 
Mikhail Kozhemyako :

이해할 시간이 없다...........

읽고 올바른 위치에 넣으십시오.

bool RefreshRates ();

///
도움이 되지 않았습니다(
 
Vitalie Postolache :
그리고 정확히 사이클에 들어가지 않는 것을 증명하십시오. 게다가 최신 주문이 필요한 경우 계정 수명의 맨 처음부터 모든 주문을 확인하는 이유는 무엇입니까???

증명: 인쇄 ("이전 작업 PriceAsk-",PriceAsk); 로그가 비어 있습니다.

게다가 최신 주문이 필요한 경우 계정 수명의 맨 처음부터 모든 주문을 확인하는 이유는 무엇입니까??? - 10개의 통화 쌍이 열려 있는 경우 다른 방법은 무엇입니까?


 

MQL에서 이것을 변경할 때까지 모든 것이 정상이었습니다. ViborOrdera=OrderSelect(prev,SELECT_BY_POS);

예전에는 이 OrderSelect (이전,SELECT_BY_POS); 와 같았습니다. 오래전 일이지만 효과가 있었습니다.