Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1330

 

Is it true that CalendarValueHistory() does not work in debug mode on historical data?

No matter what dates it asks for, there are always 0 values. It works fine in debug mode.


 
mbjen:

Is it true that CalendarValueHistory() does not work in debug mode on historical data?

No matter what dates it asks for, it always has 0 values. In debug, realtime works fine.


ok, in backtest it doesn't work

 
Is it possible to modify the trailing stop.
Suppose the robot took a long position and reached +100 ticks
(Stop loss was set at -50) Trailing jumped to +50,
A correction occurs and price moves back by +50 ticks. At this point, instead of the trailing edge taking us out of the position, we buy one more contract at the current price and set the stop loss at the same -50 ticks.
And this should be repeated 2-3 times?


 
Eugen8519:
I always do that, I re-test almost all of them.
Suppose the robot took a long position and reached +100 ticks
(Stop loss was set at -50) Trailing jumped to +50,
A correction occurs and price moves back by +50 ticks. At this point, instead of the trailing order knocking us out of the position, we buy one more contract at the current price and set the stop loss at the same -50 ticks.
And this is repeated 2-3 times?


You may buy them at a certain price, you may buy them at a certain moment and then you'll have to buy them again.

 
Hello. Could you please tell me how to change trailing step in the built-in trailing stop from 1 pip to 5 pips? In other words, I want it to be pulled up every 5 pips? Yep.
 
askbid3737:
Hello. Could you please tell me how to change the trailing step in the built-in tra iling stop, from 1 pip to 5 pips? In other words, I want it to be pulled up every 5 pips? Yep.

SelectTrailing Stop and the menu item "Set Level... "

Общие принципы - Торговые операции - Справка по MetaTrader 5
Общие принципы - Торговые операции - Справка по MetaTrader 5
  • www.metatrader5.com
Перед тем как приступить к изучению торговых функций платформы, необходимо создать четкое представление об основных терминах: ордер, сделка и...
 
SanAlex:

Of course there is everything your heart desires. You just need to look into the kodobase and test all the EAs, they are definitely there - I always do that and almost all the EAs I re-test.

I've done a lot of testing there myself, but I haven't come across a suitable option.

I think that the problem is to make the second trailing stop, like a trailing stop, but with a task to buy a contract.
After all, in the long position, when you pull up the trailing stop, a limit order (sell stop) is opened, if I'm not mistaken.
And it is exactly sell stop that is changed to BUY ORDER.


This is my trailing stop.


void Trailing()
  {
   if(InpTrailingStop==0)
      return;
   for(int i=PositionsTotal()-1; i>=0; i--) // returns the number of open positions
      if(m_position.SelectByIndex(i))
         if(m_position.Symbol()==m_symbol.Name() && m_position.Magic()==m_magic)
           {
            if(m_position.PositionType()==POSITION_TYPE_BUY)
              {
               if(m_position.PriceCurrent()-m_position.PriceOpen()>ExtTrailingStop+ExtTrailingStep)
                  if(m_position.StopLoss()<m_position.PriceCurrent()-(ExtTrailingStop+ExtTrailingStep))
                    {
                     if(!m_trade.PositionModify(m_position.Ticket(),
                                                m_symbol.NormalizePrice(m_position.PriceCurrent()-ExtTrailingStop),
                                                m_position.TakeProfit()))
                        Print("Modify ",m_position.Ticket(),
                              " Position -> false. Result Retcode: ",m_trade.ResultRetcode(),
                              ", description of result: ",m_trade.ResultRetcodeDescription());
                    }
              }
            else
              {
               if(m_position.PriceOpen()-m_position.PriceCurrent()>ExtTrailingStop+ExtTrailingStep)
                  if((m_position.StopLoss()>(m_position.PriceCurrent()+(ExtTrailingStop+ExtTrailingStep))) ||
                     (m_position.StopLoss()==0))
                    {
                     if(!m_trade.PositionModify(m_position.Ticket(),
                                                m_symbol.NormalizePrice(m_position.PriceCurrent()+ExtTrailingStop),
                                                m_position.TakeProfit()))
                        Print("Modify ",m_position.Ticket(),
                              " Position -> false. Result Retcode: ",m_trade.ResultRetcode(),
                              ", description of result: ",m_trade.ResultRetcodeDescription());
                    }
              }
           }



I was thinking about leaving it and adding a trailing buy/sell.


Maybe someone has an idea?

 

Eugen8519   Может у кого есть идея? 

you could also add a trawl like this - and you can execute any command from the object

https://www.mql5.com/ru/forum/233860/page43#comment_13219147

Вечер выходного дня
Вечер выходного дня
  • 2019.09.14
  • www.mql5.com
В этой теме исключительно на выходных принимаются заявки на "быстро забацать MQL5 советника...
 

Hi all!

Can you tell me if it is possible to use MT4 synchronously from a smartphone and a PC on one account?

So, what to place orders via smartphone, and see and edit in PC realtime?

Thank you!

 
T41:

Hi all!

Can you tell me if it is possible to use MT4 synchronously from a smartphone and a PC on one account?

So, what to place orders via smartphone, and see and edit in PC realtime?

Thank you!

This is a branch on MQL5.

Orders and positions (MQL5) are equally placed, modified and closed via PC or smartphone, manually, in real time.

Reason: