trailingator
trailingator

trailingator

更新日期:
2022-10-26
分类标签:
语言:
中文
平台:
没限制

25 人已下载 手机查看

描述文字
trailingator

/*
Generated by EX4-TO-MQ4 decompiler V4.0.224.1 []
Website: http://purebeam.biz
E-mail : purebeam@gmail.com
*/
#property copyright “Copyright @ Rita Lasker”
#property link “http://www.ritalasker.com”

extern bool ProfitTrailing = TRUE;
extern double TrailingStop = 15.0;
extern double TrailingStep = 2.0;
extern int MagicNumber = -1;
double gd_100;

int init() {
gd_100 = Point;
if (Digits == 5 || Digits == 3) gd_100 = 10.0 * gd_100;
return (0);
}

void start() {
if (TrailingStop > 0.0 && OrdersTotal() > 0) RealTrailOrder();
}

void RealTrailOrder() {
double l_ord_open_price_20;
double l_ord_stoploss_28;
double l_price_36;
double ld_0 = MarketInfo(Symbol(), MODE_STOPLEVEL) * Point / gd_100;
double ld_8 = MathMax(TrailingStop, ld_0);
for (int l_pos_16 = OrdersTotal() – 1; l_pos_16 >= 0; l_pos_16–) {
if (OrderSelect(l_pos_16, SELECT_BY_POS, MODE_TRADES) == TRUE) {
if (OrderMagicNumber() == MagicNumber || MagicNumber < 0 && OrderSymbol() == Symbol()) {
l_ord_open_price_20 = OrderOpenPrice();
l_ord_stoploss_28 = OrderStopLoss();
while (IsTradeContextBusy()) Sleep(500);
RefreshRates();
if (OrderType() == OP_BUY) {
l_price_36 = ND(Bid – ld_8 * gd_100);
if (Bid > l_ord_open_price_20 + ld_8 * gd_100 || !ProfitTrailing && l_price_36 >= l_ord_stoploss_28 + TrailingStep * gd_100 && ld_8 * gd_100 > ld_0 * gd_100) {
if (!OrderModify(OrderTicket(), OrderOpenPrice(), l_price_36, OrderTakeProfit(), 0, Blue))
if (!IsOptimization()) Print(“BUY OrderModify Error ” + GetLastError());
}
}
if (OrderType() == OP_SELL) {
l_price_36 = ND(Ask + ld_8 * gd_100);
if (Ask < l_ord_open_price_20 – ld_8 * gd_100 || !ProfitTrailing && l_price_36 <= l_ord_stoploss_28 – TrailingStep * gd_100 || l_ord_stoploss_28 == 0.0 && ld_8 * gd_100 > ld_0 * gd_100) {
if (!OrderModify(OrderTicket(), OrderOpenPrice(), l_price_36, OrderTakeProfit(), 0, Red))
if (!IsOptimization()) Print(“Sell OrderModify Error ” + GetLastError());
}
}
}
}
}
}

double ND(double ad_0) {
return (NormalizeDouble(ad_0, Digits));
}

如果你对文件有了解,请帮助投票!

If you are familiar with the file, please help vote!

平均评分 0 / 5. 投票数: 0

到目前为止还没有投票!成为第一位投票人。

相关资源

暂无评论

none
暂无评论...