[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 894

 
artmedia70:
What is your point? It's like you can ask about the time... or health... :))))))

That's just a reminder. I read the book, but there are points that need to be clarified - so I write them. and sometimes there is no answer.

Please - don't take this aggressively, I mean it in good faith!

 
belck:

That's just a reminder. I read the book, but there are points that need to be clarified, so I write them. and sometimes there is no answer.


Do you pay for the answers? No? Or you are ignored? Or someone owes you a favor?

SZS: I often look in this thread, how can I help, but on condition that the person who asked a question, at least he understands what he asked, while you have your mountain of questions looks like lazy to read - explain it to me

 
Hi ! I can't figure out what's wrong with ???? Does not modify market order
slb =NormalizeDouble(Bid - (StopLoss * Point),Digits); // calculate stop for buy positions//
tpb =NormalizeDouble(Ask + (TakeProfit* Point),Digits); // calculate profit for buy positions//
sls =NormalizeDouble(Ask + (StopLoss * Point),Digits) // calculation of stop for sell positions//
tps =NormalizeDouble(Bid - (TakeProfit* Point),Digits);

//================================================== ==================//
int total=OrdersTotal();
int n=0;
for (int i=total-1; i>=0; i--)
{
if(OrderSelect(i, SELECT_BY_POS))
{
if(OrderSymbol()==Symbol())
{
n++;
}}}
if ( total == 1 )
{
for (int k=total-1; k>=0; k--)
{
if(OrderSelect(k, SELECT_BY_TICKET)
Alert("order is", k);
{
if ((OrderType()==OP_BUY)&&(OrderTakeProfit()==0)&&(O rderStopLoss()==0))
{
OrderModify(k,OrderOpenPrice(),slb,tpb,0,Blue);
Alert("error", GetLastError());

}}}}
return(0);}

WHAT'S THE PROBLEM PLEASE HELP ...........?????
 
IgorM:


Do you pay for the answers? No? Or are you being ignored? Or do you owe anything to anyone?

ZS: I often look in this thread, what I can, I help, but provided that the person who asked a question, at least he understands what he asked, with your mountain of questions looks like lazy to read - deal with me

I told you not to take it too hard. We're not here to fight. I also do not like it when someone refuses to help - that is, he decides for me to give advice or read a book. As they say - clever!

Once again, guys, please do not take it aggressively or my request is still a contradiction, if so, then I will not write it anymore.

 
int total=OrdersTotal();
int n=0;
for (int i=total-1; i>=0; i--)
  {
    if(OrderSelect(i, SELECT_BY_POS))
      {
        if(OrderSymbol()==Symbol())
            n++;
      }
  }
if (total == 1)
  {
    for (int k=total-1; k>=0; k--)
      {
        if(OrderSelect(k, SELECT_BY_TICKET))
          {
            Alert("ордер есть ", k);
            if ((OrderType()==OP_BUY)&&(OrderTakeProfit()==0)&&(OrderStopLoss()==0))
              {
                OrderModify(k,OrderOpenPrice(),slb,tpb,0,Blue);
                Alert("ошибка ", GetLastError());
              }
          }
      }
  }
return(0);
Try this code.
 

Does anyone know a script "trailing stop" triggered by levels, i.e. price reached 150 - stop 130, then reached 180 - stop 170 (for example) (levels typed by yourself).

Thank you in advance.

 
VOLDEMAR:
Hi ! I can't figure out what the problem is ???? Does not modify market order
slb =NormalizeDouble(Bid - (StopLoss * Point),Digits); // calculation of stop for buy positions//
tpb =NormalizeDouble(Ask + (TakeProfit* Point),Digits); //calculate profit for buy positions//
sls =NormalizeDouble(Ask + (StopLoss * Point),Digits); //calculate stop for sell positions//
tps =NormalizeDouble(Bid - (TakeProfit* Point),Digits);

//================================================== ==================//
int total=OrdersTotal();
int n=0;
for (int i=total-1; i>=0; i--)
{
if(OrderSelect(i, SELECT_BY_POS))
{
if(OrderSymbol()==Symbol())
{
n++;
}}}
if ( total == 1 )
{
for (int k=total-1; k>=0; k--)
{
if(OrderSelect(k, SELECT_BY_TICKET))
Alert("order exists", k);
{
if ((OrderType()==OP_BUY)&&(OrderTakeProfit()==0)&&(OderStopLoss()==0))
{
OrderModify(k,OrderOpenPrice(),slb,tpb,0,Blue);
Alert("error", GetLastError());

}}}}
return(0);}

WHAT'S THE PROBLEM HELP ...........?????

You are selecting a position on the ticket. But you don't check exactly WHERE it is... The position may be in already closed ones:

bool OrderSelect( int index, int select, int pool=MODE_TRADES)

This function selects an order for further manipulation. Returns TRUE if the function completes successfully. Returns FALSE if the function fails. To get information about an error, you need to call GetLastError() function.

The pool parameter is ignored if the order is selected by the ticket number. The ticket number is a unique identifier for the order. To determine from which list an order is selected, its closing time must be analysed. If the time of closing of the order is 0, then the order is open or pending and is taken from the list of open positions of the terminal. An open position can be distinguished from a pending order by its type. If the time of closing is not equal to 0, then the order is closed or pending and has been selected from the history of the terminal. The distinction between a closed order and a deleted pending order can also be made by order type.
 
AlexAlex:

Does anyone know a script "trailing stop" triggered by levels, i.e. price reached 150 - stop 130, then reached 180 - stop 170 (for example) (levels typed by yourself).

Thank you in advance.

Search on the site "trailing" or "trawl" - you will find it.
 
VOLDEMAR:
Hi ! I can't figure out what the problem is ???? Doesn't modify the market order

Try it like this:

slb = 25; // расчёт стопа для бай позиций//
tpb = 25; // расчёт профита для бай позиций//
sls = 25; // расчёт стопа для селл позиций//
tps = 25; 

//================================================== ==================//
int start {
ticket=OrderSend(Symbol(),OP_BUY,1,Ask,3,Bid-slb*Point,Ask+tpb*Point,"My order #"+counter,16384,0,Green);
     if(ticket<0)
       {
        Print("OrderSend failed with error #",GetLastError());
        return(0);
       }

}
 
AlexAlex:

Does anyone know a script "trailing stop" triggered by levels, i.e. price reached 150 - stop 130, then reached 180 - stop 170 (for example) (levels typed by yourself).

Thank you in advance.

https://www.mql5.com/ru/code/7108 .No.4