102 lines
2.0 KiB
Markdown
102 lines
2.0 KiB
Markdown
# Draw Signal
|
|
|
|
```mql
|
|
//
|
|
// Draw a shape On Chart ...
|
|
if (hasLongSignal) {
|
|
//
|
|
arrowups++;
|
|
|
|
//
|
|
string arrowUpName = StringConcatenate(signalPrefix, "_ArrowUp_", arrowups);
|
|
|
|
//
|
|
datetime arrowTime = iTime(
|
|
_Symbol,
|
|
_Period,
|
|
bar_index
|
|
);
|
|
|
|
//
|
|
double arrowPrice = iOpen(
|
|
_Symbol,
|
|
_Period,
|
|
bar_index
|
|
);
|
|
arrowPrice = arrowPrice - (100 * _Point);
|
|
|
|
//
|
|
// Draw Signal Arrow Shape ...
|
|
bool isDraw = DrawArrow(
|
|
0,
|
|
arrowUpName,
|
|
0,
|
|
arrowTime,
|
|
arrowPrice,
|
|
SYMBOL_ARROWUP,
|
|
ANCHOR_BOTTOM,
|
|
clrAqua,
|
|
STYLE_SOLID,
|
|
3,
|
|
false,
|
|
false,
|
|
false,
|
|
0
|
|
);
|
|
|
|
//
|
|
// SL Info ...
|
|
XSLInfo slInfo = GetSwngSL(bar_index);
|
|
|
|
//
|
|
// TP Info ...
|
|
XTPInfo tpInfo = GetTP(bar_index);
|
|
|
|
|
|
//
|
|
string arrowUpSLName = StringConcatenate(signalPrefix, "_SL_", arrowups);
|
|
string arrowUpTPName = StringConcatenate(signalPrefix, "_TP_", arrowups);
|
|
|
|
//
|
|
datetime time1 = iTime(
|
|
_Symbol,
|
|
_Period,
|
|
bar_index + 1
|
|
);
|
|
datetime time2 = iTime(
|
|
_Symbol,
|
|
_Period,
|
|
bar_index
|
|
);
|
|
|
|
//
|
|
// Draw Signal SL ...
|
|
DrawTrendLine(
|
|
0,
|
|
arrowUpSLName,
|
|
0,
|
|
time1,
|
|
slInfo.longSL,
|
|
time2,
|
|
slInfo.longSL,
|
|
clrFuchsia,
|
|
STYLE_SOLID,
|
|
2
|
|
);
|
|
|
|
//
|
|
// Draw Signal TP ...
|
|
DrawTrendLine(
|
|
0,
|
|
arrowUpTPName,
|
|
0,
|
|
time1,
|
|
tpInfo.longTP,
|
|
time2,
|
|
tpInfo.longTP,
|
|
clrAqua,
|
|
STYLE_SOLID,
|
|
2
|
|
);
|
|
}
|
|
``` |