Yeni başlayanlardan sorular MQL5 MT5 MetaTrader 5 - sayfa 934

 
Sinyallerle ilgili makalede ördek. Öyle değil
 
void ClosePositions()
  {
   for ( int i= PositionsTotal ()- 1 ;i>= 0 ;i--) // returns the number of current orders
       if (m_position.SelectByIndex(i))     // selects the position by index for further access to its properties
         if (m_position. Symbol ()==m_symbol.Name() && m_position.Magic()==Magic)
            m_trade.PositionClose(m_position.Ticket()); // close a position by the specified symbol
  }
Bir pozisyonu bulmak ve kapatmak için bu işlevi nasıl değiştireceğimi söyle AAA
Совершение сделок - Торговые операции - MetaTrader 5
Совершение сделок - Торговые операции - MetaTrader 5
  • www.metatrader5.com
Торговая деятельность в платформе связана с формированием и отсылкой рыночных и отложенных ордеров для исполнения брокером, а также с управлением текущими позициями путем их модификации или закрытия. Платформа позволяет удобно просматривать торговую историю на счете, настраивать оповещения о событиях на рынке и многое другое. Открытие позиций...
 
EgorKim :
Bir pozisyonu bulmak ve kapatmak için bu işlevi nasıl değiştireceğimi söyle AAA

Yardım: CPositionInfo

Metin özelliklerine erişiliyor...
 

Teşekkür ederim.

Ayrıca, lütfen derlerken neden 'sayıdan' 'dize'ye örtük dönüştürmeye yemin ettiğini söyleyin.

if(m_trade.Buy(InpLots,m_symbol.Name(),m_symbol.Ask(),sl,tp,"AAA")

Bir satın alma komutu nasıl görünmelidir?

 
EgorKim :

Teşekkür ederim.

Ayrıca, lütfen derlerken neden 'sayıdan' 'dize'ye örtük dönüştürmeye yemin ettiğini söyleyin.

if(m_trade.Buy(InpLots,m_symbol.Name(),m_symbol.Ask(),sl,tp,"AAA")

Bir satın alma komutu nasıl görünmelidir?

Yardım: Satın alın .

Yardım: Koşullu if-else ifadesi

 

Kodu yanlış yazdım.

İşte kod

 long      chislo       = 5 ;
if (m_trade.Buy(InpLots,m_symbol.Name(),m_symbol. Ask (),sl,tp, "AAA" +chislo))

Derleyici "AAA" +chislo'ya yemin ediyor

 
EgorKim :

Kodu yanlış yazdım.

İşte kod

Derleyici "AAA" +chislo'ya yemin ediyor

Yardım: IntegerToString


Eklendi: Bugünlük bu kadar. Ben zaten uyuyorum.

 
EgorKim :

Kodu yanlış yazdım.

İşte kod

Derleyici "AAA" +chislo'ya yemin ediyor

 long      chislo       = 5 ;
if (m_trade.Buy(InpLots,m_symbol.Name(),m_symbol. Ask (),sl,tp, "AAA" + ( string ) chislo))
 

Vladimir Karputov, Alexey Viktorov

teşekkürler

 

Bana kodu söyle lütfen.

Şu anda her biri 1 lotluk 4 alış ve her biri 1 lotluk 4 satış var. Sembol aynı.

Bu formda sadece 1 alış 1 satış kapalıdır.

 void CloseBy()
  {
   ulong ticket_buy= ULONG_MAX ;
   ulong ticket_sell= ULONG_MAX ;
   for ( int i= 0 ;i< PositionsTotal ();i++) // ATTENTION! Here, specially began a detour with "0"
       if (m_position.SelectByIndex(i)) // selects the position by index for further access to its properties
         {
         if (m_position.PositionType()== POSITION_TYPE_BUY && ticket_buy== ULONG_MAX )
            ticket_buy=m_position.Ticket();

         if (m_position.PositionType()== POSITION_TYPE_SELL && ticket_sell== ULONG_MAX )
            ticket_sell=m_position.Ticket();
        }
   if (ticket_buy!= ULONG_MAX && ticket_sell!= ULONG_MAX )
      m_trade.PositionCloseBy(ticket_buy,ticket_sell);
//---
   return ;
  }

Hiçbir şey böyle kapanmaz.

 void CloseBy()
  {
   ulong ticket_buy= ULONG_MAX ;
   ulong ticket_sell= ULONG_MAX ;
   for ( int i= 0 ;i< PositionsTotal ();i++) // ATTENTION! Here, specially began a detour with "0"
       if (m_position.SelectByIndex(i)) // selects the position by index for further access to its properties
        {
         if (m_position.PositionType()== POSITION_TYPE_BUY && ticket_buy== ULONG_MAX )
            ticket_buy=m_position.Ticket();

         if (m_position.PositionType()== POSITION_TYPE_SELL && ticket_sell== ULONG_MAX )
            ticket_sell=m_position.Ticket();
        }
   if (ticket_buy!= ULONG_MAX && ticket_sell!= ULONG_MAX )
      m_trade.PositionCloseBy(ticket_buy,ticket_sell);
//---
   //return;
  }

4 alış ve 4 satışın hepsinin karşı tarafta kapalı olduğundan nasıl emin olunur?