[Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2. - page 174

 

This is the area where the market order is triggered if the limit cannot be set. Maybe this is where the problem lies? It worked in the tester :(

ticket=OrderSend(Symbol(),4,lot,buy,3*mno,sll,tpp,NULL,magic,timecl,blue);
if(ticket<1){// error handling
err=GetLastError();
if(err==147){// timeout
Err147=true;
ticket=OrderSend(Symbol(),4,lot,buy,3*mno,sll,tpp,NULL,magic,0,Blue);
if(ticket>0){
WriteOrder(ticket,timecl);
}else{
err=GetLastError();
if(err==130){
if(Set_order_from_market){
RefreshRates();
ticket=OrderSend(Symbol(),0,lot,Ask,3*mno,sll,tpp,NULL,magic,0,Blue);
if(ticket<1){
err=GetLastError();
Print("Error setting order from market # ",err,
" Order type = BUY ",
"Open price =",Ask,
" Price = ",Ask,
" Stop Loss = ",sll,
" TakeProfit = ",tpp);
}
}else{
}
}
}
}
if(err==130){
if(Set_order_from_the_market){
RefreshRates();
ticket=OrderSend(Symbol(),0,lot,Ask,3*mno,sll,tpp,NULL,magic,0,Blue);
if(ticket<1){
err=GetLastError();
Print("Error setting order from market # ",err,
" Order type = BUY ",
"Open price =",Ask,
" Price = ",Ask,
" Stop Loss = ",sll,
" TakeProfit = ",tpp);
}
}else{
}
}
Print("4 Order setting error # ",err);
}
}
}
}
 

put at the beginning of the function
sll = NormalizeDouble (sll, MarketInfo( Symbol (), MODE_DIGITS)); tpp = NormalizeDouble (tpp, MarketInfo( Symbol (), MODE_DIGITS))

 
alsu:

put
sll = NormalizeDouble (sll, MarketInfo( Symbol (), MODE_DIGITS)); tpp = NormalizeDouble (tpp, MarketInfo( Symbol (), MODE_DIGITS));



Stands like this. Unfortunately, I'm not too well versed in the code...

if(typ>0){
if(CountOpOrd(4,magic)<1){
if(buy!=0){
if(OpPrise(buy){RefreshRates();
if(buy-Ask<stlw*Point){NormalizeDouble(Ask+stlw*Point,Digits);}
if(sl<0){sll=NormalizeDouble(buy-((buy-sell)*(sl/(-100))),Digits);}
if(sl>0){sll=NormalizeDouble(buy-sl*Point*mno,Digits);}
if(tp>){tpp=NormalizeDouble(buy+tp*Point*mno,Digits);}
if(tp<0){tpp=NormalizeDouble(buy+((buy-sell)*(-tp/100)),Digits);}
ticket=OrderSend(Symbol(),4,lot,buy,3*mno,sll,tpp,NULL,magic,timecl,Blue);
if(ticket<1){// error handling
err=GetLastError();
if(err==147){// disallow expiration time
Err147=true;
ticket=OrderSend(Symbol(),4,lot,buy,3*mno,sll,tpp,NULL,magic,0,Blue);
if(ticket>0){
WriteOrder(ticket,timecl);
}else{
err=GetLastError();
if(err==130){
if(Set_order_from_market){
RefreshRates();
ticket=OrderSend(Symbol(),0,lot,Ask,3*mno,sll,tpp,NULL,magic,0,Blue);
if(ticket<1){
err=GetLastError();
Print("Error setting order from market # ",err,
" Order type = BUY ",
"Open price =",Ask,
" Price = ",Ask,
" Stop Loss = ",sll,
" TakeProfit = ",tpp);
}
}else{
}
}
}
}
if(err==130){
if(Set_order_from_the_market){
RefreshRates();
ticket=OrderSend(Symbol(),0,lot,Ask,3*mno,sll,tpp,NULL,magic,0,Blue);
if(ticket<1){
err=GetLastError();
Print("Error setting order from market # ",err,
" Order type = BUY ",
"Open price =",Ask,
" Price = ",Ask,
" Stop Loss = ",sll,
" TakeProfit = ",tpp);
}
}else{
}
}
Print("4 Order setting error # ",err);
}
}
}
}
 

The logic is confusing, you can't make it out.

This line does nothing at all :

if(buy-Ask<stlw*Point){NormalizeDouble(Ask+stlw*Point,Digits);

Those who wrote it need to figure it out first :))

In general, put my lines just before you open orders. That won't make it worse anyway, but if the error persists, it will be obvious that it was caused by a stop level violation, because 130 is the only way to make an error.

 
alsu:

The logic is confusing, you can't make it out.

This line does nothing at all :

Those who wrote it need to figure it out first :))

In general, put my lines just before you open orders. That won't make it worse anyway, but if the error persists, it will be obvious that it was caused by a stop level violation, because 130 is the only way to make an error.

https://www.mql5.com/ru/code/10111 - here. Maybe there's an answer here...
 

The tipster is a little crooked...

You'd better ask the author, show me my line, which does nothing. xrust is an experienced man, he will figure out how to correct it.

 
alsu:

A little crooked EA...

You'd better ask the author, show me my line, which does nothing. xrust is an experienced man, he will figure out how to tweak it.


At least he does :)

There are bugs, but not fatal...

xrust isnot getting in touch :(

I myself am waiting for a version without bugs. Maybe he will lay it out...

 
how is the ALERT sign called ? because its beeping and gurgling sounds when the signal is given and I can't find it ((...)
 
Rossi:
how is the ALERT table called ? because its beeping and gurgling sounds when the signal is given and I can't find it ((...
Alert()
 
Can you please tell me how to select a closed order? The point is, I want to close a position(manually opened and the position will always be one - this is the maximum), so the music will play if the order was in the plus, if negative, then the other, if in null, then the third. You can enter the conditions through OrderProfit, but I do not know how to remove the last closed order from the history.