新人对MQL4和MQL5的任何问题,对算法和代码的帮助和讨论 - 页 1124

 
Vladimir Karputov:

enum_trade_request_actions

识别器

描述

交易_行动_交易

以指定的参数下达立即执行的交易指令(市价单)。

正在进行的贸易行动

在指定的条件下下达交易指令,以便执行(挂单)。

TRADE_ACTION_PENDING交易操作的例子,用于下一个挂单。

#property description "Example of placing pending orders"
#property script_show_inputs
#define  EXPERT_MAGIC 123456                             // MagicNumber of the expert
input ENUM_ORDER_TYPE orderType=ORDER_TYPE_BUY_LIMIT;   // order type
//+------------------------------------------------------------------+
//| Placing pending orders                                           |
//+------------------------------------------------------------------+
void OnStart()
  {
//--- declare and initialize the trade request and result of trade request
   MqlTradeRequest request={0};
   MqlTradeResult  result={0};
//--- parameters to place a pending order
   request.action   =TRADE_ACTION_PENDING;                             // type of trade operation
   request.symbol   =Symbol();                                         // symbol
   request.volume   =0.1;                                              // volume of 0.1 lot
   request.deviation=2;                                                // allowed deviation from the price
   request.magic    =EXPERT_MAGIC;                                     // MagicNumber of the order
   int offset = 50;                                                    // offset from the current price to place the order, in points
   double price;                                                       // order triggering price
   double point=SymbolInfoDouble(_Symbol,SYMBOL_POINT);                // value of point
   int digits=SymbolInfoInteger(_Symbol,SYMBOL_DIGITS);                // number of decimal places (precision)
   //--- checking the type of operation
   if(orderType==ORDER_TYPE_BUY_LIMIT)
     {
      request.type     =ORDER_TYPE_BUY_LIMIT;                          // order type
      price=SymbolInfoDouble(Symbol(),SYMBOL_ASK)-offset*point;        // price for opening 
      request.price    =NormalizeDouble(price,digits);                 // normalized opening price 
     }
   else if(orderType==ORDER_TYPE_SELL_LIMIT)
     {
      request.type     =ORDER_TYPE_SELL_LIMIT;                          // order type
      price=SymbolInfoDouble(Symbol(),SYMBOL_ASK)+offset*point;         // price for opening 
      request.price    =NormalizeDouble(price,digits);                  // normalized opening price 
     }
   else if(orderType==ORDER_TYPE_BUY_STOP)
     {
      request.type =ORDER_TYPE_BUY_STOP;                                // order type
      price        =SymbolInfoDouble(Symbol(),SYMBOL_ASK)+offset*point; // price for opening 
      request.price=NormalizeDouble(price,digits);                      // normalized opening price 
     }
   else if(orderType==ORDER_TYPE_SELL_STOP)
     {
      request.type     =ORDER_TYPE_SELL_STOP;                           // order type
      price=SymbolInfoDouble(Symbol(),SYMBOL_ASK)-offset*point;         // price for opening 
      request.price    =NormalizeDouble(price,digits);                  // normalized opening price 
     }
   else Alert("This example is only for placing pending orders");   // if not pending order is selected
//--- send the request
   if(!OrderSend(request,result))
      PrintFormat("OrderSend error %d",GetLastError());                 // if unable to send the request, output the error code
//--- information about the operation
   PrintFormat("retcode=%u  deal=%I64u  order=%I64u",result.retcode,result.deal,result.order);
  }
//+------------------------------------------------------------------+
 
Vladimir Karputov:

enum_trade_request_actions

识别器

描述

交易_行动_交易

以指定的参数下达立即执行的交易指令(市价单)。

正在进行的贸易行动

在指定的条件下下达交易指令,以便执行(挂单)。

谢谢你!

 
Vladimir Karputov:

TRADE_ACTION_PENDING交易操作的例子,用于下一个挂单。

弗拉基米尔,你不能用俄语写吗?
 
Artyom Trishkin:
弗拉基米尔,你不能用俄语写吗?

你不能。因为我完整地引用了参考文献中的内容。否则,这是个漫长的过程:每个人都有一张 "票",有些人有 "票"。这就是为什么功能、帮助和帮助中的引语都是英文的原因。

 
Vladimir Karputov:

你不能。因为我完整地引用了参考资料。否则,这是个漫长的过程:每个人都有一张 "票",有些人有 "票"。这就是为什么功能、参考文献和参考文献中的引文都是英文的原因。

而他们有 "门票",只是因为他们开始用谷歌进行翻译 :)
在俄罗斯的官方帮助下,有 "门票"。
在forest-da-drow只是从免费的翻译。
 

大家好!我认为这个问题主要是针对专业人士的(事实证明)。已经过了一个星期,有一个关于代码的问题。

例如 - 我们知道M5蜡烛包含5个蜡烛M1(例如,00:00,00:01,00:02,00:03和00:04)。此外,我们将只考虑这种结合--即我们在M1上运行指标并希望看到M5的指标读数

也就是说,为了正确地在下层TF上显示中间的数据,我应该在下层TF的所有5个柱子出现时进行循环。这意味着周期应该是从0到4 - 这是最大的,而历史上的空隙不被考虑。问题是,我得到了从0到5的循环,而我没有足够的逻辑来使它达到4!相信我,我已经为这个问题纠结了一个星期,我真的请求你的帮助。下面是一个非常截断的代码,其中循环到5而不是4。我希望它4!!!!!

#property copyright ""
#property link      ""
#property version   ""
#property indicator_chart_window

//+----------------------------------------------+
//| Входные параметры индикатора                 |
//+----------------------------------------------+
input ENUM_TIMEFRAMES TF=PERIOD_M5;
int LastCountBar;
datetime tt;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,    // количество истории в барах на текущем тике
                const int prev_calculated,// количество истории в барах на предыдущем тике
                const datetime &time[],
                const double &open[],
                const double& high[],     // ценовой массив максимумов цены для расчёта индикатора
                const double& low[],      // ценовой массив минимумов цены  для расчёта индикатора
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
   datetime IndTime[1];
//--- объявления локальных переменных
   int limit,bar;
//--- индексация элементов в массивах как в таймсериях
   ArraySetAsSeries(time,true);
//--- расчёт стартового номера first для цикла пересчёта баров
   if(prev_calculated>rates_total || prev_calculated<=0) // проверка на первый старт расчёта индикатора
     {
      limit=100; // стартовый номер для расчёта всех баров
      LastCountBar=limit;
     }
   else
      limit=LastCountBar+rates_total-prev_calculated; // стартовый номер для расчёта новых баров

//--- основной цикл расчёта индикатора
   for(bar=limit; bar>=0; bar--)
     {
      //--- копируем вновь появившиеся данные в массив IndTime
      if(CopyTime(Symbol(),TF,time[bar],1,IndTime)<=0)
         return(0);
         
      if(time[bar]>=IndTime[0] && time[bar+1]<IndTime[0])
        {
         LastCountBar=bar;
         //--- Далее проводим вычисления индикатора МТФ ...............
         Print(bar," ",IndTime[0]);
         //---
        }
     }
   return(rates_total);
  }
//+------------------------------------------------------------------+
 

如何添加一个列表视图编辑窗口?

https://www.mql5.com/en/docs/standardlibrary/controls/clistview

我有上面的图书馆。我想在这个列表中添加一个带标签的编辑框。 你能告诉我如何才能做到这一点吗?我试过了,但没有用。

Documentation on MQL5: Standard Library / Panels and Dialogs / CListView
Documentation on MQL5: Standard Library / Panels and Dialogs / CListView
  • www.mql5.com
//|                                             ControlsListView.mq5 | //|                        Copyright 2017, MetaQuotes Software Corp. | //|                                             https://www.mql5.com | //| defines                                                          |  INDENT_LEFT                         (11)      ...
 
Artyom Trishkin:
而他们有 "门票",只是因为他们开始用谷歌进行翻译 :)
在俄罗斯的官方参考文献中,"tickety-boo"。
进入森林--达-德罗瓦只是从免费的翻译。
好吧,我承认:抓住了我。回答得很快,没有切换帮助语言 😎
 
问题是这样的。我是否可以通过一个按钮打开2个(或更多)图表,使它们垂直放置,平均占据整个显示器?
 
Vladimir Karputov:
好吧,我承认:抓住了我。 回答得很快,没有切换帮助语言 😎

收到;)