Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1144

 
MrBrooklin:

Thanks, Vladimir, for the tip!

The thing is that this module was downloaded from the website and simply compiled in MetaEditor. I haven't performed any other actions (e.g., code changes, etc.) with the trading signals module and the warning was generated by the compiler itself.

Best regards, Vladimir.

Downloaded from where? That's where you downloaded it, so write about the issue in the code discussion.

 
Vladimir Karputov:

Downloaded from where? That's where you downloaded it, that's where you should write in the code discussion about the problem you noticed.

Downloaded here https://www.mql5.com/ru/articles/358 from mysignals.zip folder.

Ok, Vladimir, I will write exactly where the problem with the code occurs in the future.

Regards, Vladimir.

Простейшие торговые системы с использованием семафорных индикаторов
Простейшие торговые системы с использованием семафорных индикаторов
  • www.mql5.com
Семафорные, или по-другому, сигнальные индикаторы представляют собой простейшие сигнализаторы для входа и выхода из рынка. Если на текущем баре появился сигнал для сделки, то на графике финансового инструмента возникает соответствующий значок, который и может служить в дальнейшем как условие для совершения сделки. Подобных индикаторов очень...
 
MrBrooklin:

Downloaded here https://www.mql5.com/ru/articles/358 from mysignals.zip folder.

Ok, Vladimir, I will write exactly where the problem with the code arises in the future.

Regards, Vladimir.

So the article is from 2012 :)

 
Vladimir Karputov:

So the article is from 2012 :)

Yes, I noticed right away, but nevertheless decided to test how the "old" trading signal modules would behave nowadays.

Regards, Vladimir.
 

When I switch the breakpoint for debugging, the breakpoints start appearing a few lines below, before the curly brackets

Is this a problem for me, or is this a new "feature"?

 
Roman Sharanov:

When I switch the breakpoint for debugging, the breakpoints start appearing a few lines below, before the curly brackets

Is this my problem, or is this a new "feature"?

You're the one with the problem.

  1. Are you trying to add code in running test mode
  2. Or your code block will never execute, so the editor throws the breakpoint cursor out of it.
 
Vladimir Karputov:

This is your problem.

  1. You are trying to add code in running test mode
  2. Or your code block will never execute, so the editor throws the breakpoint cursor out of it.

Luckily yes, after reloading the editor it's cured!

 
Hello!
Who can advise a good broker to get started in MT5 trading?
Thanks a lot!
 
Dmitry Filippov:
Hello!
Who can advise a good broker to get started in MT5 trading?
I can't think of any. Thank you!

Have you read the resource rules? Or as usual, break it first and then read the manual?

 

Hello!

I can't find the error. The purpose of the function is to set a stop loss only at the breakeven position. If there is more than one position open by the symbol, only those positions that can be set to breakeven, the rest of the positions will not have a stop placed on them. Also modify existing stops at the closest tothe current price, if the current stop is less than the biggest breakeven position, the stop is modified. Error " CTrade::OrderSend: modify position #3 EURUSD (sl: 1.10871, tp: 0.00000) [invalid stops]
"


void _BTrailing_BUY()
  {
   double _B_BUY=0.0;
   CPositionInfo m_positionBuy; // trade position object
   CTrade m_tradeBuy; // trading object
   CSymbolInfo    m_symbolBuy;

   int TrailingStop=35; //Trailing Stop LEVEL
   
   for(int i=PositionsTotal()-1; i>=0; i--)  
      if(m_positionBuy.SelectByIndex(i))  
        {
         string position_GetSymbol=m_positionBuy.Symbol();  
         if(position_GetSymbol==Symbol())
           {
            long digits=SymbolInfoInteger(position_GetSymbol,SYMBOL_DIGITS);
            long _SYMBOL_TRADE_STOPS_LEVEL=SymbolInfoInteger(position_GetSymbol,SYMBOL_TRADE_STOPS_LEVEL);
            m_adjusted_point=SymbolInfoDouble(position_GetSymbol,SYMBOL_POINT);
            double _PriceCurrent_Stop=0.0;

            if(TrailingStop>_SYMBOL_TRADE_STOPS_LEVEL)
              {_SYMBOL_TRADE_STOPS_LEVEL=TrailingStop;};
                 if(m_positionBuy.PositionType()==POSITION_TYPE_BUY)
              {
               _PriceCurrent_Stop=NormalizeDouble(m_positionBuy.PriceOpen()+((_SYMBOL_TRADE_STOPS_LEVEL)*m_adjusted_point),int(digits));
               if(m_positionBuy.PriceCurrent() >  _PriceCurrent_Stop)
                 {
                  if(_B_BUY==0.0 || _B_BUY <_PriceCurrent_Stop)
                    {
                     _B_BUY=_PriceCurrent_Stop;
                    };
                  if(_B_BUY >m_positionBuy.StopLoss() && _B_BUY >_PriceCurrent_Stop)
                    {
                     _PriceCurrent_Stop=_B_BUY;
                    };

                  if(_PriceCurrent_Stop>m_positionBuy.StopLoss() || m_positionBuy.StopLoss()==0.0)
                    {
                     //--- save Magic Number for the position
                     if(_PriceCurrent_Stop>0)
                       {
                        //m_trade.SetExpertMagicNumber(m_position.Magic());
                        m_tradeBuy.PositionModify(m_positionBuy.Ticket(),
                                                  _PriceCurrent_Stop,
                                                  m_positionBuy.TakeProfit());
                       };

                    };
                 };



              };
           };

        };

  }
Документация по MQL5: Константы, перечисления и структуры / Торговые константы / Свойства ордеров
Документация по MQL5: Константы, перечисления и структуры / Торговые константы / Свойства ордеров
  • www.mql5.com
Приказы на проведение торговых операций оформляются ордерами. Каждый ордер имеет множество свойств для чтения, информацию по ним можно получать с помощью функций Идентификатор позиции, который ставится на ордере при его исполнении. Каждый исполненный ордер порождает сделку, которая открывает новую или изменяет уже существующую позицию...
Reason: