更简单的部分:...最好忘记自定义指标(全部共享单线程/块)
为了更快,更安全的GUI,可以完全控制绘制这些正交形状,New- MQL4/MQL5 语言可以使用如下内容:
// --------------------------------------------------------------------
#define GUI_aFontSIZE 10
#define GUI_aFontNAME "Courier New"
#define GUI_aTradeCOLOR C'80,0,80'
#define GUI_aTPed_COLOR clrDarkGreen
#define GUI_aSLed_COLOR clrDarkRed
#define GUI_isSELECTABLE True
long GUI_aMainWINDOW = CharID();
int GUI_anObjNUMBER = 0;
string anInterimObjNAME = StringFormat( "GUI.DEMO_RectangularOBJECT_[%d]", GUI_anObjNUMBER );
if ( ObjectFind( anInterimObjNAME ) == GUI_aMainWINDOW )
ObjectDelete( anInterimObjNAME ); //--- prevent collisions
ObjectCreate( GUI_aMainWINDOW, anInterimObjNAME, OBJ_RECTANGLE, 0, aTimeOfENTRY, anEntryPRICE,
aTimeOfEXIT, DBL_MIN
);
ObjectSetInteger( GUI_aMainWINDOW, anInterimObjNAME, OBJPROP_COLOR, GUI_aSLed_COLOR ); //--- set color
ObjectSetInteger( GUI_aMainWINDOW, anInterimObjNAME, OBJPROP_BACK, True ); //--- display in the foreground (false) or background (true) ~ FILL-IT ~
ObjectSetInteger( GUI_aMainWINDOW, anInterimObjNAME, OBJPROP_SELECTABLE, GUI_isSELECTABLE ); //---------------------------------------- MAY AVOID GUI interactions
ObjectSetInteger( GUI_aMainWINDOW, anInterimObjNAME, OBJPROP_SELECTED, False ); //--- set GUI-object as (non)-pre-SELECT-ed
ObjectSetInteger( GUI_aMainWINDOW, anInterimObjNAME, OBJPROP_HIDDEN, False ); //--- hide (true) or display (false) graphical object name in the object list
ObjectSetInteger( GUI_aMainWINDOW, anInterimObjNAME, OBJPROP_ZORDER, 1 ); //--- set the "layered" priority for receiving a mouse-click-event in the chart
// --------------------------------------------------------------------
如果有疑问,请使用GUI对象面板手动进行实验,并在语言文档中导出缺少的语法说明 .
可能会使用更复杂且风险更高的方法:
如果故事要基于自定义指标,则玩具会变得更加复杂 .
有一个硬编码引擎,它处理所谓的 IndicatorBuffer 中的数据 .
如果某个特定数据元素碰巧等于 EMPTY_VALUE ,则为这些特定条形提供特殊处理 .
这样的 EMPTY_VALUE 常量信号给处理引擎指示器的值是 not shown in the chart ,这让你感到惊讶 .
例如,对于周期为20的内置指标标准偏差,历史中前19个条的线根本不会显示在图表中,使用此功能技巧 . 可以在任何地方使用相同的方法,一直到当前条 [0] ,甚至是动态的,以便模拟"vibrations":o) ( do not risk this in production ... ).
这也可以在 aPriceDOMAIN 显示自定义指标中创建"dropped"部分绘制区域 .
对于绘制“两个”通用自定义指示线之间的区域(在“振荡”曲线之间),必须使用更多技巧,使用:
//--- plot dual-line-filled----------------------------------------------
#property indicator_label "DEMO-Custom-2-Line-Filled-Indicator"
#property indicator_type DRAW_FILLING // THE MAGIC FILL-STYLING
#property indicator_color clrAqua,clrSalmon // THE MAGIC FILL-STYLING
#property indicator_width 2
//--- Custom Indicator buffers -----------------------------------------
double aCustomIndicatorLineDATA_buffer1[];
double aCustomIndicatorLineDATA_buffer2[];
//--- Next, fill DATA as usually and the GUI shows the magic FILL-STYLING
无论如何:
享受MQL4 / MQL5的狂野世界