//+------------------------------------------------------------------+//| Script 1.mq5 |//| Copyright 2020, MetaQuotes Software Corp. |//| https://www.mql5.com |//+------------------------------------------------------------------+#property copyright"Copyright 2020, MetaQuotes Software Corp."#property link"https://www.mql5.com"#property version"1.00"//---#include <Trade\PositionInfo.mqh>
#include <Trade\OrderInfo.mqh>
//---CPositionInfo m_position; // object of CPositionInfo classCOrderInfo m_order; // object of COrderInfo class//---//+------------------------------------------------------------------+//| Script program start function |//+------------------------------------------------------------------+voidOnStart()
{
int count_buys = 0.0;
int count_sells = 0.0;
int count_buy_limits = 0.0;
int count_sell_limits = 0.0;
int count_buy_stops = 0.0;
int count_sell_stops = 0.0;
//---for(int i=PositionsTotal()-1; i>=0; i--)
if(m_position.SelectByIndex(i)) // selects the position by index for further access to its properties
{
if(m_position.PositionType()==POSITION_TYPE_BUY)
count_buys++;
elseif(m_position.PositionType()==POSITION_TYPE_SELL)
count_sells++;
}
//---for(int i=OrdersTotal()-1; i>=0; i--) // returns the number of current ordersif(m_order.SelectByIndex(i)) // selects the pending order by index for further access to its properties
{
if(m_order.OrderType()==ORDER_TYPE_BUY_LIMIT)
count_buy_limits++;
elseif(m_order.OrderType()==ORDER_TYPE_SELL_LIMIT)
count_sell_limits++;
elseif(m_order.OrderType()==ORDER_TYPE_BUY_STOP)
count_buy_stops++;
elseif(m_order.OrderType()==ORDER_TYPE_SELL_STOP)
count_sell_stops++;
}
//--- you code
}
//+------------------------------------------------------------------+//+------------------------------------------------------------------+
我如何以编程方式了解账户类型?对冲还是净值化?
或者像这样
m_label_info[3].Description(m_account.MarginModeDescription());
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
请告诉我错误在哪里。
SELL_STOP - 订单被计算,但SELL不希望这样。根据该算法,如果没有,就下SELL_STOP订单,如果至少有一个,就不下订单。请告诉我错误在哪里。
SELL_STOP - 订单被计算在内,但SELL不想要。根据该算法,如果没有,就下SELL_STOP订单,如果至少有一个,就不下订单。不要把LOCAL ORDER 和POSITION 混为一谈。
不要把REMOTE ORDER 和POSITION 混淆。
每次调用onCalculate函数时,它都等于0。
,我通过print函数输出begin的值。
参考书上说,开始是 "有意义的数据开始的地方"。这并没有告诉我什么。
我不明白onCalculate函数的 第二个变体中的参数begin负责什么。每次调用onCalculate函数时,它都等于0。 ,我通过print函数使开始值输出。参考书上说,开始是 "有意义的数据开始的地方"。这并没有告诉我什么。
请看实例中的开放指标代码。
看一下例子中的开放指标代码。
我看了看。总是开始=0。
在这里,我从AMA指标中提取了一段代码
如果(begin!=0)
PlotIndexSetInteger(0,PLOT_DRAW_BEGIN,ExtPeriodAMA+begin)。
如果条件begin!=0永远不为真,这段代码应该告诉我什么?
它最后给出了一些废话,比封闭的订单多得多。