Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1048

 

Here even wrote the prints



Made an entry, maybe this will helphttp://recordit.co/ot9m4jpiws

 
Roman Sharanov:

Here even wrote the prints


The lowdown on the modification request is actually not changing the levels that already exist.
 
Vladimir Karputov:
I can't perform a modification request without actually changing already existing levels.

So what is causing the error? That I'm trying to put the old stop (zero in this case) in the stop.

I've added a check on the record, if the same take is the same, then no transfer is done...but still the same

Or do i have to normalize the tee, otherwise it doesn't check?

 
Roman Sharanov:

So what is causing the error? That I'm trying to put the old stop (zero in this case) in the stop.

I've added a check on the record, if the same take is the same, then no transfer is done...but still the same

Or I need to normalise the TP, otherwise it won't check?

The position had these stops: one watermelon and three melons. You want to change the stops and, attention, you send an order: one watermelon and three melons.

That is, there is actually no change in stops.
 
Vladimir Karputov:
The position had these stops: one watermelon and three melons. You want to change the stops and, attention, you send an order: one watermelon and three melons.

So there is effectively no change in the stops.

I see. Then how do I change that take profit without changing the stop level?

 
Roman Sharanov:

Got it. Then how do I change the take profit without changing the stop level?

You don't understand anything. Read about watermelons and melons until it becomes clear.
 
Vladimir Karputov:
You don't understand anything. Read about watermelons and melons until it's clear.

Let's abstract from the fact that I have

I have a position, its take on level 5, its entry on level 3, its stop on level 2

I want to take it to level 6.

How do I do that?

 
Roman Sharanov:

Let's abstract from the fact that I have

I have a position, its take on level 5, its entry on level 3, its stop on level 2

I want to take it to level 6.

How do I do that?

Full code. Symbol. Timeframe. Date when test started. Graph (screenshot). Log file of the "Log" tab.
This is the minimum.
I am waiting until tomorrow.
 

Forum on Trading, Automated Trading Systems and Strategy Tests

FAQ from Beginners MQL5 MT5 MetaTrader 5

Roman Sharanov, 2019.05.23 09:43

void transposeTakeProfit(double tpLvl){
        for(int i = PositionsTotal() - 1; i >= 0; i--){
        PositionSelectByTicket(PositionGetTicket(i));
        if(PositionGetString(POSITION_SYMBOL) == _Symbol && PositionGetInteger(POSITION_MAGIC) == _magic){
                trade.PositionModify(PositionGetTicket(i), PositionGetDouble(POSITION_SL), tpLvl);
        }
   }
}

Well, here it happens, a trade opens, a level is passed to which I have to move all the take profit, if there are other trades

But this is the first trade, goes straight into this function and immediately an error


PositionSelectByTicket is absolutely unnecessary here. It is enough to leave the selected one.

To avoid trying to place a stop or a take at the price where it is already placed, we should check if the new stop or take is equal to the old one.

And we need to understand how many spreads are the minimum level for placing a stop.

 

Hi all. Please tell me what the hell is going on.

I'm writing code in mql5, I want to use the PositionClose function, but it says "Man! PositionClose' - the function can be declared only in the global scope".

I was like, I mean this same function is in #include <Trade\Trade.mqh> by default.


Checked. It's there.

Why is it showing off, what does it need, how to close the position?


The code itself


string bumaga1 = "SBERP";
 int MinuteClose;
 
//---------- Закрываем позиции и удаляем ордера перед концом сессии старт
 MinuteClose =  MinuteMQL4();
 
 if (PositionSelect(bumaga1) && HOUR1 == 18 && MinuteClose > 15)
 {
                bool  PositionClose(bumaga1, 3);
 }
 
  if (!PositionSelect(bumaga1) && HOUR1 == 18)
  {
                                bool  OrderDelete(tik1);
   }
   
//---------- Закрываем позиции и удаляем ордера перед концом сессии энд