[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 919

 
Nilog:

Can you tell me how to remove objects created by the indicator in the window when the indicator itself is removed from the chart?

using the special function deinit()

and enumerating the names of all objects in the loop, or if there are few of them, prescribing them separately

bool ObjectDelete( string name)
Deletes an object with specified name. If deleted successfully, the function returns TRUE, otherwise FALSE.
To get more information about the error, call GetLastError() function.
Parameters:
name - Name of deleted object.
Example:
ObjectDelete("text_object");
 
forex-k:

--with the special function deinit()--

Thank you!

 
Suppose I have 1 open order and then a second pending order opens, how do I make the take profit of the first order equal to the take profit of the second order? and so on, 1,2=3 1,2,3=4 1,2,3,4=5 ?
 

I'm not kidding, my Expert Advisor really does not work!

The only answer is "it should work", but it does not.

The only answer to this question was "it should work", but it does not.

i think that the problem may be something else?

extern double StopLoss=50.0;
extern double TakeProfit=50.0;
extern double Lots=1;
extern int total;

int start()
{
double Price_1, Price_2, min, max;
RefreshRates();
Price_1=Bid;
Price_2=Ask;

min=iLow(NULL,0,2);
max=iHigh(NULL,0,2);
total=OrdersTotal();
if(total<1)
{

if(Price_1>max)
OrderSend(Symbol(),OP_BUY,Lots,Ask,5,Bid-StopLoss*Point,Ask+TakeProfit*Point,"My order#",16384,0,Green);

if(Price_2<min)
OrderSend(Symbol(),OP_SELL,Lots,Bid,5,Ask+StopLoss*Point,Bid-TakeProfit*Point,"My order#",16384,0,Green);
}
}
return(0);

The smiley is smiling all the time but it is not working, positions are not opening.

 
gheka:

I'm not kidding, my Expert Advisor really does not work!

The only answer is "it should work", but it does not.

The only answer to this question was "it should work", but it does not.

i think that the problem may be something else?

extern double StopLoss=50.0;
extern double TakeProfit=50.0;
extern double Lots=1;
extern int total;

int start()
{
double Price_1, Price_2, min, max;
RefreshRates();
Price_1=Bid;
Price_2=Ask;

min=iLow(NULL,0,2);
max=iHigh(NULL,0,2);
total=OrdersTotal();
if(total<1)
{

if(Price_1>max)
OrderSend(Symbol(),OP_BUY,Lots,Ask,5,Bid-StopLoss*Point,Ask+TakeProfit*Point,"My order#",16384,0,Green);

if(Price_2<min)
OrderSend(Symbol(),OP_SELL,Lots,Bid,5,Ask+StopLoss*Point,Bid-TakeProfit*Point,"My order#",16384,0,Green);
}
}
return(0);

The smiley is smiling all the time but it is not working, positions are not opening.

it means there are already open positions in the account
 
Necron:
it means there are already open positions in the account

I opened a new demo account, i never touched the deposit,

i don't know if it has something to do with the type of DTs?

 

Why is the sound only repeated once?

if (Balance < Loss)
      {    
           for(int i = 0; i < 5; i++) 
           PlaySound("LossLimitReached.wav");  
           Sleep (1000);                            
      }
 
Nilog:

Why is the sound only repeated once?


if (Balance < Loss)
      {
           for(int i = 0; i < 5; i++) 
           {   -  ты наверно это забыл поставить 
           PlaySound("LossLimitReached.wav");  
           Sleep (1000);
           }   -  и это тоже                 
      }
 
gheka:


Added. Still only repeats once. :(
 

There is another way, take your sound, put it into NERO (sound editing software), if available, make one sound

5 of them.

If I'm not mistaken, "i++" works on every tick, i.e. the sound will be pronounced for 5 ticks in a row.

Also, just in case, look here https://book.mql4.com/ru/operators/for

Reason: