134 lines
14 KiB
MQL5
134 lines
14 KiB
MQL5
//+------------------------------------------------------------------+
|
|
//| CtrlPanelComment.mqh |
|
|
//| Copyright 2021, MetaQuotes Ltd. |
|
|
//| https://www.mql5.com |
|
|
//+------------------------------------------------------------------+
|
|
|
|
#ifndef CTRL_PANEL_MINI_MQH
|
|
#define CTRL_PANEL_MINI_MQH
|
|
|
|
//+------------------------------------------------------------------+
|
|
//| |
|
|
//+------------------------------------------------------------------+
|
|
class CCtrlPanelMini: public CCtrlPanelComment
|
|
{
|
|
public:
|
|
CCtrlPanelMini() {};
|
|
CCtrlPanelMini(const string param);
|
|
~CCtrlPanelMini() {};
|
|
|
|
|
|
virtual void CreatePanelItems();
|
|
virtual void OnTickCalculateEvent();
|
|
|
|
protected:
|
|
int _count_item;
|
|
|
|
|
|
};
|
|
|
|
//+------------------------------------------------------------------+
|
|
//| |
|
|
//+------------------------------------------------------------------+
|
|
CCtrlPanelMini::CCtrlPanelMini(const string param):CCtrlPanelComment(param)
|
|
{
|
|
|
|
}
|
|
|
|
//+------------------------------------------------------------------+
|
|
//| |
|
|
//+------------------------------------------------------------------+
|
|
void CCtrlPanelMini::CreatePanelItems()
|
|
{
|
|
string str;
|
|
_count_item=1;
|
|
_panel.SetText(0,GenerateHeader(), _color_caption);
|
|
|
|
// Информация о сете
|
|
str=PrepStr(set_name,"; ")+PrepStr(set_pair,"; ")+PrepStr(set_version,"; ","v.")+PrepStr(set_author,";");
|
|
if(StringLen(str))
|
|
_panel.SetText(_count_item++,str,_color_text);
|
|
|
|
str=(ReflectSellSettingsToBuy?"SELL&BUY: ":"SELL: ")
|
|
+PrepStr(IntegerToString(_sell_grid_levels.count),"; ")+PrepStr(DoubleToString(_sell_len_max,0)," pts; ")
|
|
+PrepStr(DoubleToString(_sell_grid_levels.first_or_default()._volume,2))
|
|
+PrepStr(DoubleToString(_sell_grid_levels.last_or_default()._volume,2),"","-")
|
|
+PrepStr(DoubleToString(_sell_volume_max,2)," lots;","-");
|
|
|
|
if(!ReflectSellSettingsToBuy)
|
|
str+="BUY:"+PrepStr(IntegerToString(_buy_grid_levels.count),"; ")+PrepStr(DoubleToString(_buy_len_max,0)," pts;")
|
|
+PrepStr(DoubleToString(_buy_grid_levels.first_or_default()._volume,2))
|
|
+PrepStr(DoubleToString(_buy_grid_levels.last_or_default()._volume,2),"","-")
|
|
+PrepStr(DoubleToString(_buy_volume_max,2)," lots;","-");
|
|
|
|
if(StringLen(str))
|
|
_panel.SetText(_count_item++,str,_color_text);
|
|
|
|
str=PrepStr(TradeSell?"Y":"NO","; ","TradeSell=","Y")+PrepStr(TradeBuy?"Y":"NO","; ","TradeBuy=","Y")+PrepStr(S_OpenFirstOrder?"Y":"NO","; ","S_OpenFirstOrder=","Y")+PrepStr(B_OpenFirstOrder?"Y":"NO","; ","B_OpenFirstOrder=","Y");
|
|
if(StringLen(str))
|
|
_panel.SetText(_count_item++,str,_color_text);
|
|
|
|
// Опции мультиторгов
|
|
str=PrepStr(IntegerToString(MaxTradePairs),"; ","MaxTradePairs=","0")
|
|
+PrepStr(IntegerToString(CurrencyBlock),"; ","CurrencyBlock=","0")
|
|
+PrepStr(IntegerToString(No1Order_ByDrawdownPercent), PrepStr(IntegerToString(No1Order_ByDrawdownPercent_Off),"%; ","% OFF=","0","%; "),"No1OrderByDD=","0")
|
|
+PrepStr(
|
|
PrepStr
|
|
(
|
|
/*value*/PrepStr(DoubleToString(CloseAllOrders_ByDrawdownMoney,0),(kernel_account::currency()=="USD")?"$":kernel_account::currency(),"","0")
|
|
/*postfix*/,PrepStr(
|
|
DoubleToString(CloseAllOrders_ByDrawdownPercent,1)
|
|
, "% "
|
|
+PrepStr(DoubleToString(short_hd._settings.close_orders_by_drawdown_for_001lot,0),((kernel_account::currency()=="USD")?"$":kernel_account::currency())+"/0.01 lot sell "," | ","0")
|
|
+PrepStr(DoubleToString(long_hd._settings.close_orders_by_drawdown_for_001lot,0),((kernel_account::currency()=="USD")?"$":kernel_account::currency())+"/0.01 lot buy"," | ","0")
|
|
," | "
|
|
,"0.0"
|
|
, PrepStr(DoubleToString(short_hd._settings.close_orders_by_drawdown_for_001lot,0),((kernel_account::currency()=="USD")?"$":kernel_account::currency())+"/0.01 lot sell "," | ","0")
|
|
+PrepStr(DoubleToString(long_hd._settings.close_orders_by_drawdown_for_001lot,0),((kernel_account::currency()=="USD")?"$":kernel_account::currency())+"/0.01 lot buy"," | ","0")
|
|
)
|
|
/*prefix*/,""
|
|
/*value_for_none*/,""
|
|
/*null_value*/,PrepStr(
|
|
DoubleToString(CloseAllOrders_ByDrawdownPercent,1)
|
|
, "% "
|
|
+PrepStr(DoubleToString(short_hd._settings.close_orders_by_drawdown_for_001lot,0),((kernel_account::currency()=="USD")?"$":kernel_account::currency())+"/0.01 lot sell "," | ","0")
|
|
+PrepStr(DoubleToString(long_hd._settings.close_orders_by_drawdown_for_001lot,0),((kernel_account::currency()=="USD")?"$":kernel_account::currency())+"/0.01 lot buy"," | ","0")
|
|
,""
|
|
,"0.0"
|
|
, PrepStr(DoubleToString(short_hd._settings.close_orders_by_drawdown_for_001lot,0),((kernel_account::currency()=="USD")?"$":kernel_account::currency())+"/0.01 lot sell","","0")
|
|
+PrepStr(DoubleToString(long_hd._settings.close_orders_by_drawdown_for_001lot,0),((kernel_account::currency()=="USD")?"$":kernel_account::currency())+"/0.01 lot buy"," | ","0")
|
|
)
|
|
),"; ","Stop="
|
|
);
|
|
|
|
if(StringLen(str))
|
|
_panel.SetText(_count_item++,str,_color_text);
|
|
|
|
str=GetParamString("comment","");
|
|
|
|
if(StringLen(str))
|
|
_panel.SetText(_count_item++,str,_color_text);
|
|
}
|
|
|
|
//+------------------------------------------------------------------+
|
|
//| |
|
|
//+------------------------------------------------------------------+
|
|
void CCtrlPanelMini::OnTickCalculateEvent()
|
|
{
|
|
CCtrlPanelComment::OnTickCalculateEvent();
|
|
|
|
TComment *item=_panel.GetList().GetNodeAtIndex(_count_item);
|
|
|
|
string s=GenerateBlockTradeInfo();
|
|
if((item==NULL&&StringLen(s))||(item!=NULL&&StringCompare(s,item.text)))
|
|
{
|
|
_panel.SetText(_count_item,s, _color_err);
|
|
_readyForUpdate=true;
|
|
}
|
|
};
|
|
|
|
|
|
#endif
|
|
//+------------------------------------------------------------------+
|
|
|
|
//+------------------------------------------------------------------+
|