//+------------------------------------------------------------------+//| 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はそれを望んでいない。アルゴリズムによれば、1つもなければSELL_STOP注文が出され、少なくとも1つあれば注文は出されない。どこにエラーがあるのか教えてください。
SELL_STOP - 注文はカウントされますが、SELLは望んでいません。アルゴリズムによれば、1つもなければSELL_STOP注文が出され、少なくとも1つあれば注文は 出されない。LOCAL ORDERと POSITIONを 混同しないようにしましょう。
REMOTE ORDERと POSITIONを 混同しないでください。
onCalculate関数が呼ばれるたびに0になります。
print関数でbeginの値を出力していました。
参考書には、ビギニングは「意味のあるデータはここから始まる」と書かれている。これでは何もわからない。
onCalculate関数の 2番目のバリアントのパラメータbeginが何を担っているのかがわかりません。onCalculate関数が呼ばれるたびに0になります。 print関数でbeginの値を出力するようにしました。参考書には、beginは「意味のあるデータはここから始まる」と書かれています。これでは何もわからない。
例題のオープンインジケーターコードを確認する。
例題のオープン・インジケータ・コードを見てください。
見たんです。常にbegin=0とする。
ここでは、AMAのインジケータからコードの一部を抜き出してみました。
if(begin!=0)
PlotIndexSetInteger(0,PLOT_DRAW_BEGIN,ExtPeriodAMA+begin);
また、begin!=0という条件が決して真で ない場合、このコードは何を伝えるべきでしょうか?
クローズド・オーダーよりもずっと、最終的にはナンセンスなものを出してくるんです。