[ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4. - page 508

 
Vinin:

If you want to speed up an indicator, please contact
If an indicator, which one? - The one that counts Mashki? Either way - it would be interesting!
 

Good afternoon! Order modification error 4051. I've been thinking for an hour. Seems to be the right parameter there!!! To make a long story short. The parameter price is the opening price of the order, OrderOpenPrice(), it is standard.

Our stop price is 10 points below the open price, and we have memorized the price. We store it in the variable tsena when opening the order.

We have two orders, one with a profit and one without. It seems to be clear. What is the error? What else could it be?

Yes, the condition seems to be clear, although it is not really relevant. I.e., price has moved by 30 points, the condition worked (tsena+30*Point).

We set perenos=true once; These conditions actually seem to work.

I myself don't know how to think.

We actually wear it once perenos=true; These conditions didn't work, because it didn't work either.


bool napravlenieCCI=false;
 if( CCI_50S<100&&CCI_50>100 ||CCI_50S<0&&CCI_50>0|| CCI_50S<-100&&CCI_50>-100  )napravlenieCCI=true;// if( CCI_50S>CCI_50&& )napravlenieCCI=false;
 
 bool wishseLMA=false;//Свеча закрывается или находится выше LMA
 if (Bid>LMA_100) wishseLMA=true;Print ("до условияsrabotka    " ,srabotka );Alert("до условияsrabotka    " ,srabotka );
 
 if (EMA_20S>EMA_10S&&EMA_20<EMA_10&&napravlenieCCI&&wishseLMA&&!srabotka) {/// нашли пирисечение сверху вниз и направление CCI вверх
 RefreshRates();
           int tacket=OrderSend (Symbol( ), OP_BUY, lot,NormalizeDouble(Ask, Digits), 5, NormalizeDouble( Ask- (35*Point),Digits), 
           NormalizeDouble( Ask+( 45*Point),Digits), NULL, 450, 0, CLR_NONE);
           int Error=GetLastError();if (Error==0){  
           Sleep(2000); RefreshRates(); double profit = NormalizeDouble( Ask+( 45*Point),Digits); tsena=Ask; perenos = false;
           int tucket=OrderSend (Symbol( ), OP_BUY, lot,NormalizeDouble(Ask, Digits), 5, NormalizeDouble( Ask- (35*Point),Digits),
           0, NULL, 450, 0, CLR_NONE); 
           if (Error==0)   
           srabotka= true; }}
           
           if (Error!=0){ string errorcomment = "Ошибка открытия  ордера OP_BUY"  + " " + Symbol() +  " " + ErrorDescript(Error); 
            Print (errorcomment);}
 
 
 if(tsena+30*Point<Ask&&!perenos){ 
 OrderModify(  tacket, OrderOpenPrice(), tsena-10*Point, OrderTakeProfit(), 0, CLR_NONE);
 Error=GetLastError();if (Error==0){  
 OrderModify(  tucket, OrderOpenPrice(), tsena-10*Point, OrderTakeProfit(), 0, CLR_NONE);
 Error=GetLastError();if (Error==0){  
 perenos=true;}}} 
 
 if (Error!=0){  errorcomment = "Ошибка модификайции ордера OP_BUY"  + " " + Symbol() +  " " + ErrorDescript(Error); 
            Print (errorcomment);BreakPoint();} 
 

There is an important parameter - tucket. However, I assign it to a variable so int tacket=OrderSend and so int tucket=OrderSend,

and I use OrderModify( tacket, and in short I don't see any formal error there!!!

 

Oh, man... 2012.11.14 22:40:17 2012.08.16 15:30 Vasilypr EURGBP,M30: 1Error 0 tacket 5 that is the order was opened, the ticket was assigned.

And further it is already equal to zero! That is, within the next code section, which deals with the modification.

2012.11.14 23:05:27 2012.08.17 11:03 Vasilypr EURGBP,M30: tacket 0 OrderOpenPrice() 0.7845 tsena-10*Point 0.7835 OrderTakeProfit() 0.789

Outside the above code area, the variable does not play at all!

I can not change the Ukrainian layout of any key combination, and written in Russian!

 
Dimka-novitsek:

There is an important parameter - tucket. However, I assign it to a variable so int tacket=OrderSend and so int tucket=OrderSend,

and I use OrderModify( tacket, and in short I don't formally see any error there!!!


Apparently, DC does not accept immediately with SL and TP. After opening modify SL and TP. And the 2nd position should not be opened immediately, with the next tick!
 
Yes, thank you. But there's a slip, and well, it opens. I'll try modifying separately, stop, and I'm only carrying a stop, right?
 
Modification error, vistas vistas.
 
Dimka-novitsek:
It's a modification error, it's a modification error.


In the tester it may work, and on Demka too, but on Real it won't!

And slippage doesn't help!

 

Why, what's not going to pass?

Oh, I get it, the frequent submission of two orders at once.

 
Dimka-novitsek:
Why, what won't pass?

It won't work to set the SL and TP at once! And when modifying them you have to put a condition with a gap! Especially in the vicinity of the price!
Reason: