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

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi ! Question is how do we know if the object is deleted manually if we only know the description of the object. i.e. object with an unknown name , take profit is attached to the object , if the object is deleted remove take profit , and we do not know the name of the object ....
Is there any way to change the name of the object ????
Please help me refine the EA! I want it to open one order when the signal comes, when the next one comes, and so on, regardless of whether there are open orders or not.
Please tell me what is wrong!
deadlock.....
if(Ma_1>Ma_2 && flagg==0) {PlaySound("news.wav"); flagg=1; flag=0; }
if(Ma_1<Ma_2 && flag==0) {PlaySound("ok.wav"); flag=1; flagg=0; }
Print(flag,flagg);
Ma_1 - short
Ma_2 - long
when Ma_1>Ma_2 beeps news.wav without stopping, and prints 0 1 (i.e. flag=0 flagg=1)
but how can it be that when flagg=1, the condition (Ma_1>Ma_2 && flagg==0) is fulfilled and {PlaySound("news.wav") passes ???
And look at a variant like this, without global variables.
deadlock.....
if(Ma_1>Ma_2 && flagg==0) {PlaySound("news.wav"); flagg=1; flag=0; }
if(Ma_1<Ma_2 && flag==0) {PlaySound("ok.wav"); flag=1; flagg=0; }
Print(flag,flagg);
Ma_1 - short
Ma_2 - long
when Ma_1>Ma_2 beeps news.wav without stopping, and prints 0 1 (i.e. flag=0 flagg=1)
but how can it be that when flagg=1, condition (Ma_1>Ma_2 && flagg==0) is fulfilled and {PlaySound("news.wav") passes ???
Print the state of the flags separately for each condition. You got it so because second flag's state is not taken into account in conditions.
P.S. And it's more convenient to print outPrint("flag=",flag, "flagg=",flagg) to avoid confusion;
That's how I have the robot in the demo. I don't remember in detail how I came up with the idea to write it.
if(Profit>AccountBalance()*koefitsientudaleniya){
int Total=OrdersTotal();
for( i=OrdersTotal()-1;i>=0;i--){
OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
if(OrderSymbol() != Symbol()) continue;
if(OrderMagicNumber() != 450) continue;
if(OrderType()==OP_SELL) {
OrderClose(OrderTicket(),OrderLots(),Ask,6,Red);Print(" i " , i," GetLastError()CloseOP_SELL ", GetLastError() );}
if(OrderType()==OP_BUY) {
OrderClose(OrderTicket(),OrderLots(),Bid,6,Red);Print(" i " , i," GetLastError()CloseOP_BUY ", GetLastError() );}}} // If the profit exceeds some value we have specified, we close all the orders!
//----
Or let our elder friends advise us...