我尝试将其ChartSetSymbolPeriod()
用于我的 [ 自定义指标 ],但是当我尝试将它与另一个 [ 智能交易系统 ] 一起使用时,该指标会减慢我的 MT4 平台。
特别是 [EA 交易] 的“订单、市场深度”类型。
//+------------------------------------------------------------------+
//| ChangeSymbol Indicator.mq4 |
//| Copyright 2016, MetaQuotes Software Corp. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2016, MetaQuotes Software Corp."
#property link "https://www.mql5.com"
#property version "1.00"
#property strict
#property indicator_chart_window
string ChangeSP = "Where I go?";
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit() {
//---
ObjectCreate ( 0, ChangeSP, OBJ_BUTTON, 0, 0, 0 );
ObjectSetInteger ( 0, ChangeSP, OBJPROP_XDISTANCE, 15 );
ObjectSetInteger ( 0, ChangeSP, OBJPROP_YDISTANCE, 100 );
ObjectSetInteger ( 0, ChangeSP, OBJPROP_XSIZE, 200 );
ObjectSetInteger ( 0, ChangeSP, OBJPROP_YSIZE, 40 );
ObjectSetString ( 0, ChangeSP, OBJPROP_TEXT, "Go to GBPUSD M15" );
ObjectSetInteger ( 0, ChangeSP, OBJPROP_COLOR, White );
ObjectSetInteger ( 0, ChangeSP, OBJPROP_BGCOLOR, Red );
ObjectSetInteger ( 0, ChangeSP, OBJPROP_BORDER_COLOR, Red );
ObjectSetInteger ( 0, ChangeSP, OBJPROP_BORDER_TYPE, BORDER_FLAT );
ObjectSetInteger ( 0, ChangeSP, OBJPROP_BACK, false );
ObjectSetInteger ( 0, ChangeSP, OBJPROP_HIDDEN, true );
ObjectSetInteger ( 0, ChangeSP, OBJPROP_STATE, false );
ObjectSetInteger ( 0, ChangeSP, OBJPROP_FONTSIZE, 12 );
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start(){
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit(){
return(0);
}
//+------------------------------------------------------------------+
void OnChartEvent( const int id,
const long &lparam,
const double &dparam,
const string &sparam
) {
if ( sparam == ChangeSP ) {
ChangeSPClick( ChangeSP );
ObjectSetInteger( 0, ChangeSP, OBJPROP_STATE, false );
}
}
//+------------------------------------------------------------------+
void ChangeSPClick( bool ChartSetSymbolPeriod ) {
bool ChangeSP_action = ChartSetSymbolPeriod( 0, "GBPUSD", 15 );
}