Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1123

 
Vladimir Simakov:
Try creating a file where you have access rights)))

I have them everywhere, exactly where?

 
Seric29:

I have them everywhere, exactly where?

You have them, but the robot has them...
 
Vladimir Simakov:
You do, but the robot does...

What about the robot? Does it need rights to create a file? Write down the specifics in more detail.

 

That's how it works.

file.open("C:\\Users\\123\\Desktop\\Moyperviyzapisfiles.txt");
file<<"Moyperviyzapisfiles";//(string)qa
file.close();

You have to look very carefully. And the phraseProgram Files(x86), is spelt like thisProgram Files (x86).

 

Once again...

void OnStart()
{
.................
   ChartNavigate(ChartID(),CHART_END,-tm);
   Print("Последняя линия на ",-tm," баре.");
   Print("Всего колен >>> ",count_lines);
   return;
}
construct_mZZ3 (EURUSD,H1)      Последняя линия на -49930 баре.
construct_mZZ3 (EURUSD,H1)      Всего колен >>> 699

And no positioning...

What's wrong with it?

 
Сергей Таболин:

Once again...

And no positioning...

What's wrong with it?

Did you look at the example in the fact sheet?

Документация по MQL5: Операции с графиками / ChartNavigate
Документация по MQL5: Операции с графиками / ChartNavigate
  • www.mql5.com
[in]  Количество баров, на которое необходимо сместить график. Положительное значение означает смещение вправо (к концу графика), отрицательное значение означает смещение влево (к началу графика). Нулевое смещение имеет смысл, когда производится навигация к началу или концу графика.
 
Artyom Trishkin:

Did you take apart the example in the help?

Looked closely at my script, forgot to disable auto-scrolling. My bad ))))

 
Сергей Таболин:

Looked closely at my script, forgot to disable auto-scrolling. My bad luck ))))

I did, however, ask about it in the beginning - in the first place ...

 

I am trying to set a pending Sell-Stop with this function

Open_Order(ORDER_TYPE_SELL_STOP,volume_o,_sl,max_high+(double)sl_o*_Point,(tp_o > 0 ? _sl - (double)tp_o * _Point : 0));

//-----

bool Open_Order(ENUM_ORDER_TYPE  type,
                double           lot,
                double           price,
                double           s_loss,
                double           t_profit)
  {
   
   MqlTradeRequest  request;
   MqlTradeResult   result;
   
   ZeroMemory(request);
   ZeroMemory(result);
   
   request.type          = type;
   request.symbol        = _Symbol;
   request.volume        = lot;
   request.type_filling  = ORDER_FILLING_FOK;
   request.action        = TRADE_ACTION_DEAL;
   request.deviation     = deviation;
   request.magic         = (ulong)id_number;
   request.price         = price;
   request.sl            = s_loss;
   request.tp            = t_profit;
   
   if(!OrderSend(request,result))
     {
      Print("Не удалось открыть ордер. Код ошибки - ",result.retcode);
      return(false);
     };
   
  //-----------------------------------------------------------------
   return(true);
  }


I double-checked it, order open price is below market price, stop above open, profit (if any) below open, it returns error 10013 and this message

2020.04.13:07:12.659 2019.01.02 06:01:00 failed instant sell stop 0.01 EURUSD at 1.13954 sl: 1.15073 [Invalid request]

... What is my mistake?
 
Alexandr Sokolov:

I am trying to set a pending Sell-Stop with this function


I double-checked it, opening price is lower than market price, stop is higher than opening, profit (if any) is lower than opening, it returns error 10013 and this message

2020.04.13:07:12.659 2019.01.02 06:01:00 failed instant sell stop 0.01 EURUSD at 1.13954 sl: 1.15073 [Invalid request]

... What is my mistake?

ENUM_TRADE_REQUEST_ACTIONS

Identifier

Description

TRADE_ACTION_DEAL

Place a trade order for an immediate execution with the specified parameters (market order)

TRADE_ACTION_PENDING

Place a trade order for the execution under specified conditions (pending order)

Reason: