MQL4 ve MQL5 ile ilgili herhangi bir acemi sorusu, algoritmalar ve kodlar hakkında yardım ve tartışma - sayfa 949

 
Ayrıca, başlatmadan sonra görünen tüm çubuk hesaplamalarını hatalı bir şekilde görüntüler....
 

Herkese iyi günler!

İşte Metatrader5 için komut dosyasının bir parçası:

 #property copyright "Copyright 2019, MetaQuotes Software Corp."
#property link        "https://www.mql5.com"
#property version    "1.00"
//---- показывать входные параметры
#property script_show_inputs
//---
#include <Trade\Trade.mqh>
#include <Trade\SymbolInfo.mqh>
CTrade         m_trade;                       // trading object
CSymbolInfo    m_symbol;                     // symbol info object
//+------------------------------------------------------------------+
//| Enum Stop or Limit                                               |
//+------------------------------------------------------------------+
enum ENUM_STOP_OR_LIMIT
  {
   stop= 0 ,     // Buy stop and Sell stop
   limit= 1      // Buy limit and Sell limit
  };
//--- input parameters
input ushort                InpUpGap          = 15 ;     // Gap for pending orders UP from the current price (in points)
input ushort                InpUpStep         = 30 ;     // Step between orders UP (in points)

input ushort                InpDownGap        = 15 ;     // Gap for pending orders DOWN from the current price (in points)
input ushort                InpDownStep       = 30 ;     // Step between orders DOWN (in points)

input ENUM_STOP_OR_LIMIT   InpPending        = stop;   // Type of pending orders

input uchar                 InpUpQuantity     = 1 ;     // UP quantity orders
input uchar                 InpDownQuantity   = 1 ;     // DOWN quantity orders

input double                InpLots           = 0.01 ;   // Lots
input ushort                InpStopLoss       = 50 ;     // Stop Loss (in points)
input ushort                InpTakeProfit     = 50 ;     // Take Profit (in points)
//---
ulong                       m_slippage= 30 ;             // slippage

double                      ExtUpGap= 0.0 ;
double                      ExtUpStep= 0.0 ;

double                      ExtDownGap= 0.0 ;
double                      ExtDownStep= 0.0 ;

double                      ExtStopLoss= 0.0 ;
double                      ExtTakeProfit= 0.0 ;
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart ()
  {
//---
   if (InpLots<= 0.0 )
     {
       Print ( "The \"Lots\" can't be smaller or equal to zero" );
       return ;
     }
//---
   if (!m_symbol.Name( Symbol ())) // sets symbol name
       return ;
   if (!RefreshRates())
       return ;

   string err_text= "" ;
   if (!CheckVolumeValue(InpLots,err_text))
     {
       Print (err_text);
       return ;
     }

//---
   if (IsFillingTypeAllowed( SYMBOL_FILLING_FOK ))
      m_trade.SetTypeFilling( ORDER_FILLING_FOK );
   else
       if (IsFillingTypeAllowed( SYMBOL_FILLING_IOC ))
         m_trade.SetTypeFilling( ORDER_FILLING_IOC );
       else
         m_trade.SetTypeFilling( ORDER_FILLING_RETURN );

//---
   m_trade.SetDeviationInPoints(m_slippage);
   m_trade.SetAsyncMode( true );

//---
   ExtUpGap = m_symbol. Point () * InpUpGap;
   ExtUpStep = m_symbol. Point () * InpUpStep;

   ExtDownGap = m_symbol. Point () * InpDownGap;
   ExtDownStep = m_symbol. Point () * InpDownStep;

   ExtStopLoss = m_symbol. Point () * InpStopLoss;
   ExtTakeProfit = m_symbol. Point () * InpTakeProfit;

//--- start work
   double start_price_ask=m_symbol.Ask()-ExtUpGap;
   double start_price_bid=m_symbol.Bid()+ExtDownGap;

//--- set pending orders
   for ( int i= 0 ; i<InpUpQuantity; i++)
     {
       double price_ask = start_price_ask+i*ExtUpStep;
       double price_bid = start_price_bid+i*ExtUpStep;
       if (InpPending==stop)
        {
         double sl = (ExtStopLoss== 0.0 )   ? 0.0 : price_ask - ExtStopLoss;
         double tp = (ExtTakeProfit== 0.0 ) ? 0.0 : price_ask + ExtTakeProfit;
         m_trade.BuyStop(InpLots,m_symbol.NormalizePrice(price_ask),m_symbol.Name(),
         m_symbol.NormalizePrice(sl),
         m_symbol.NormalizePrice(tp));
        }
       else
        {
         double sl = (ExtStopLoss== 0.0 )   ? 0.0 : price_bid + ExtStopLoss;
         double tp = (ExtTakeProfit== 0.0 ) ? 0.0 : price_bid - ExtTakeProfit;
         m_trade.SellLimit(InpLots,m_symbol.NormalizePrice(price_bid),m_symbol.Name(),
         m_symbol.NormalizePrice(sl),
         m_symbol.NormalizePrice(tp));
        }
     }

   for ( int i= 0 ; i<InpDownQuantity; i++)
     {
       double price_ask = start_price_ask-i*ExtDownStep;
       double price_bid = start_price_bid-i*ExtDownStep;
       if (InpPending==limit)
        {
         double sl = (ExtStopLoss== 0.0 )   ? 0.0 : price_ask - ExtStopLoss;
         double tp = (ExtTakeProfit== 0.0 ) ? 0.0 : price_ask + ExtTakeProfit;
         m_trade.BuyLimit(m_symbol.LotsMin(),m_symbol.NormalizePrice(price_ask),m_symbol.Name(),
         m_symbol.NormalizePrice(sl),
         m_symbol.NormalizePrice(tp));
        }
       else
        {
         double sl = (ExtStopLoss== 0.0 )   ? 0.0 : price_bid + ExtStopLoss;
         double tp = (ExtTakeProfit== 0.0 ) ? 0.0 : price_bid - ExtTakeProfit;
         m_trade.SellStop(m_symbol.LotsMin(),m_symbol.NormalizePrice(price_bid),m_symbol.Name(),
         m_symbol.NormalizePrice(sl),
         m_symbol.NormalizePrice(tp));
        }
     }
  }

Planlandığı gibi, komut dosyası, talep ve tekliften belirli bir mesafede bekleyen limit emirleri veya durdurma emirleri belirlemelidir. Limit bekleyen emirler sorunsuz bir şekilde belirlenir, ancak durdurma emirleri değildir. Lütfen Buy Stop ve Sell Stop bekleyen emirlerinin neden ayarlanmadığını anlamama yardım edin.

Saygılarımla, Vladimir.

 
Merhaba millet. Açık nizamın yakınına kura yazımı yapıldı.
         for ( int no1= 0 ; no1< OrdersTotal (); no1++){
     if ( OrderSelect (no1,SELECT_BY_POS,MODE_TRADES)){
     if (OrderSymbol()== Symbol () && OrderType()== OP_BUY){
     ObjectCreate ( "LOTB" +OrderTicket(), OBJ_TEXT , 0 , TimeCurrent (),OrderOpenPrice());
    ObjectSetText( "LOTB" +OrderTicket(),OrderLots()* 100 , 20 , "Arial" , clrWheat );   
     ObjectSetInteger ( 0 , "LOTB" +OrderTicket(), OBJPROP_ANCHOR , ANCHOR_RIGHT_UPPER );  }}} 
Bana bu listenin son metnini nasıl alacağımı söyle?
 
Rustam Bikbulatov :
Merhaba millet. Açık nizamın yakınına kura yazımı yapıldı. Bana bu listenin son metnini nasıl alacağımı söyle?
 
Yevhenii Levchenko :

ilk önce tüm metinleri bulmanız ve bu fonksiyonla ondan hesaplamanız mı gerekiyor?

 
Rustam Bikbulatov :

ilk önce tüm metinleri bulmanız ve bu fonksiyonla ondan hesaplamanız mı gerekiyor?

Yakın zamanda mql4 dilini kendim öğrendiğim için bunu tam olarak bilmiyorum. Her şey kılavuzda. Nesneden veya bir parçadan gelen tüm metne mi ihtiyacınız var?
 
Yevhenii Levchenko :
Yakın zamanda mql4 dilini kendim öğrendiğim için bunu tam olarak bilmiyorum. Her şey kılavuzda. Nesnedeki veya bir parçadaki tüm metne mi ihtiyacınız var?

Geçen sefer yazılanlara ihtiyacım var

 
Merhaba millet. Açık nizamın yakınına kura yazımı yapıldı.
         for ( int no1= 0 ; no1< OrdersTotal (); no1++){
     if ( OrderSelect (no1,SELECT_BY_POS,MODE_TRADES)){
     if (OrderSymbol()== Symbol () && OrderType()== OP_BUY){
     ObjectCreate ( "LOTB" +OrderTicket(), OBJ_TEXT , 0 , TimeCurrent (),OrderOpenPrice());
    ObjectSetText( "LOTB" +OrderTicket(),OrderLots()* 100 , 20 , "Arial" , clrWheat );   
     ObjectSetInteger ( 0 , "LOTB" +OrderTicket(), OBJPROP_ANCHOR , ANCHOR_RIGHT_UPPER );  }}} 
Bana bu listenin son metnini nasıl alacağımı söyle?
 
Rustam Bikbulatov :
Merhaba millet. Açık nizamın yakınına kura yazımı yapıldı. Bana bu listenin son metnini nasıl alacağımı söyle?

Hangi listeden?

Ve lütfen düzenleyicideki şekillendiriciyi kullanın (Ctrl+<):

 for ( int no1= 0 ; no1< OrdersTotal (); no1++)
  {
   if ( OrderSelect (no1,SELECT_BY_POS,MODE_TRADES))
     {
       if (OrderSymbol()== Symbol () && OrderType()== OP_BUY)
        {
         ObjectCreate ( "LOTB" +OrderTicket(), OBJ_TEXT , 0 , TimeCurrent (),OrderOpenPrice());
         ObjectSetText( "LOTB" +OrderTicket(),OrderLots()* 100 , 20 , "Arial" , clrWheat );
         ObjectSetInteger ( 0 , "LOTB" +OrderTicket(), OBJPROP_ANCHOR , ANCHOR_RIGHT_UPPER );
        }
     }
  } 
//+------------------------------------------------------------------+

Ne nereden alınmalı?

 
Artyom Trishkin :

Hangi listeden?

Ve lütfen düzenleyicideki şekillendiriciyi kullanın (Ctrl+<):

Ne nereden alınmalı?

Bu fonksiyon, her siparişte bir sayı, daha doğrusu lot*100 yazar.

Şimdi en son hangi sayının olduğunu gösteren bir ters fonksiyona ihtiyacımız var.

Neden: