MT4黄金甲5币EA原版源码,黄金甲5B.mql4源码,货币联动对冲马丁源码

原理
黄金甲5币EA是一款货币联动对冲马丁格尔型的且在相比其它同类型EA属风险较低的EA,利用了货币间的联动关系,达到充分对冲作用。但是和大多数马丁EA一样,他也害怕的单边,尤其是其中风险变量日系货币的单边。
另外盈利能力的相对低下,以及持仓时间较长,对成本的要求较高。

点击下载程序与源码 文件大小:5.60 KB

MQL4/ MQL4/Experts/ MQL4/Experts/黄金甲5B.mq4 MQL4/Libraries/ 必须读我.txt 策汇在线.url

MQL4/Experts/黄金甲5B.mq4代码片段:

 //+------------------------------------------------------------------+ //| 黄金甲5B | //| Copyright 2020.策汇在线 http://www.fxchs.com | //| http://www.fxchs.com | //+------------------------------------------------------------------+ #property copyright "Copyright ?2009, Phoenix Software Corp." #property link "www.xxx.com" extern bool OrderValue = FALSE; extern string Main = "EURUSD"; string gs_96 = "0:Trend ; 1:Buy ; 2:Sell"; extern int MainDirection = 0; extern string Correlation1 = "USDJPY"; extern string Correlation2 = "EURJPY"; extern string Correlation3 = "AUDUSD"; extern string Correlation4 = "NZDUSD"; bool gi_140 = FALSE; bool gi_144 = FALSE; bool gi_148 = FALSE; bool gi_152 = FALSE; string gs_156 = "True:By G-MA ; False:No"; extern bool CheckOrder = FALSE; extern int WinPoint = 8; extern double TakeProfit = 150.0; extern double StopLoss = 10000.0; string gs_188 = "True:Reverse ; False:By Trend"; extern bool TwoWay = FALSE; extern double MaxLots = 3.0; extern int Magic = 55555; extern int TimeFrame = 15; extern int TimeFrame2 = 60; extern int TimeFrame3 = 240; extern int TimeFrame4 = 1440; extern int BreakEvenLevel = 8; extern bool LastTradeStop = FALSE; extern double LotNo1 = 0.02; extern double LotNo2 = 0.03; extern double LotNo3 = 0.04; extern double LotNo4 = 0.05; extern double LotNo5 = 0.06; extern double LotNo6 = 0.07; extern double LotNo7 = 0.08; extern double LotNo8 = 0.09; extern double LotNo9 = 0.1; extern double LotNo10 = 0.11; extern double LotNo11 = 0.12; extern double LotNo12 = 0.13; extern double LotNo13 = 0.14; extern double LotNo14 = 0.15; extern double LotNo15 = 0.16; extern double LotNo16 = 0.17; extern double LotNo17 = 0.18; extern double LotNo18 = 0.19; extern double LotNo19 = 0.2; extern double LotNo20 = 0.3; extern int LossPoint1 = 8; extern int LossPoint2 = 12; extern int LossPoint3 = 16; extern int LossPoint4 = 20; extern int LossPoint5 = 25; extern int LossPoint6 = 30; extern int LossPoint7 = 40; extern int LossPoint8 = 50; extern int LossPoint9 = 60; extern int LossPoint10 = 70; extern int LossPoint11 = 80; extern int LossPoint12 = 90; extern int LossPoint13 = 100; extern int LossPoint14 = 110; extern int LossPoint15 = 120; extern int LossPoint16 = 130; extern int LossPoint17 = 140; extern int LossPoint18 = 150; extern int LossPoint19 = 160; extern int LossPoint20 = 170; string gs_476 = "alert2.wav"; string gs_484 = ""; string gs_492 = ""; string gs_500 = ""; double gd_508 = 0.0; double gd_516 = 0.0; double gd_524 = 0.0; int gi_532 = -1; int gi_536 = 0; int gi_540 = 0; int gia_544[5]; int gi_548 = 0; int gia_552[8] = {8941301, 127, 11, 127, 15, 62, 953701}; int gi_556 = 0; int gi_560; int gi_564; int gia_568[210]; int gia_572[5]; int gi_576; int gi_580; string gs_584 = "0123456789098765432123456789098765432123456789098765432123456789005385389485"; string gs_592 = "abcdefguijklmnopqrstuvwxyz1234567898abcdefguijklmnopqrstuvwxywwwzlocksoftcom"; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int init() { if (StringGetChar(gs_584, 0) != '+') return (-1); if (StringGetChar(gs_584, 1) != 'E') return (-1); if (StringGetChar(gs_584, 2) != '>') return (-1); if (StringGetChar(gs_584, 3) != 'N') return (-1); if (StringGetChar(gs_584, 4) != '/') return (-1); if (StringGetChar(gs_584, 5) != 24) return (-1); if (StringGetChar(gs_584, 6) != ',') return (-1); if (StringGetChar(gs_584, 7) != 27) return (-1); if (StringGetChar(gs_584, 8) != 'O') return (-1); if (StringGetChar(gs_584, 9) != '1') return (-1); if (StringGetChar(gs_584, StringGetChar(gs_584, 17) + 18) != StringGetChar(gs_584, StringGetChar(gs_584, 17) + 20) + StringGetChar(gs_584, StringGetChar(gs_584, 17) + 22)) return (-1); if (StringGetChar(gs_584, 16) != TimeDay(TimeLocal()) + 7) return (-1); ObjectsDeleteAll(0, OBJ_LABEL); Comment(""); gs_484 = "_CloseAllOrder_"; gs_500 = "_CloseMagic_" + Magic + "_"; gs_492 = "_OpenRev_" + Magic + "_"; if (!GlobalVariableCheck(gs_484)) SetReason(gs_484, 0); if (!GlobalVariableCheck(gs_500)) SetReason(gs_500, 0); if (IsDemo()) start(); return (0); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int deinit() { ObjectsDeleteAll(0, OBJ_LABEL); return (0); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int start() { EAdo(); EAdo(); EAdo(); ShowInfor(); return (0); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void EAdo() { double ld_0; int li_8; if (AccountProfit() < (-1.0 * StopLoss) || GetReason(gs_484) == 1) { Alert("Stop Loss ,Close ALL !!"); SetReason(gs_484, 1); if (TwoWay) SetReason(gs_492, 1); DoCloseAll(); DoCloseAll(); RefreshInfor(); if (gi_536 == 0) SetReason(gs_484, 0); } else { if (AccountProfit() > TakeProfit || GetReason(gs_484) == 1) { Alert("Take Profit, Close ALL !!"); SetReason(gs_484, 1); if (TwoWay) SetReason(gs_492, 1); DoCloseAll(); DoCloseAll(); RefreshInfor(); if (gi_536 == 0) SetReason(gs_484, 0); } else { RefreshInfor(); if ((gd_524 >= 10.0 * gd_508 * WinPoint && gd_508 > 0.0) || GetReason(gs_500) == 1) { Alert("Win Point ,Close ! Magic:" + Magic); SetReason(gs_500, 1); if (TwoWay) SetReason(gs_492, 1); DoCloseMagic(); DoCloseMagic(); RefreshInfor(); if (gi_540 + gi_548 == 0) SetReason(gs_500, 0); } else { RefreshInfor(); if ((gi_540 >= BreakEvenLevel && gd_524 > 0.0) || GetReason(gs_500) == 1) { Alert("Arrival Break-Even Close All! Magic:" + Magic); SetReason(gs_500, 1); if (TwoWay) SetReason(gs_492, 1); DoCloseMagic(); DoCloseMagic(); RefreshInfor(); if (gi_540 + gi_548 == 0) SetReason(gs_500, 0); } else { RefreshInfor(); if (gi_540 + gi_548 == 0) { if (LastTradeStop) return; ld_0 = GetReason(gs_492); if (ld_0 != 1.0) { if (GetTrend2() > 0) OrderSend(Main, OP_BUY, CheckLots(GetLot(0, Main)), MarketInfo(Main, MODE_ASK), 3, 0, 0, "[" + Magic + "]黄金甲5B ;N." + ((gi_540 + 1)), Magic, 0, Lime); else if (GetTrend2() < 0) OrderSend(Main, OP_SELL, CheckLots(GetLot(0, Main)), MarketInfo(Main, MODE_BID), 3, 0, 0, "[" + Magic + "]黄金甲5B ;N." + ((gi_540 + 1)), Magic, 0, Red); } else { li_8 = LastType(); if (li_8 == 1) OrderSend(Main, OP_BUY, CheckLots(GetLot(0, Main)), MarketInfo(Main, MODE_ASK), 3, 0, 0, "[" + Magic + "]黄金甲5B ;N." + ((gi_540 + 1)), Magic, 0, Lime); else if (li_8 == 0) OrderSend(Main, OP_SELL, CheckLots(GetLot(0, Main)), MarketInfo(Main, MODE_BID), 3, 0, 0, "[" + Magic + "]黄金甲5B ;N." + ((gi_540 + 1)), Magic, 0, Red); } } else SetReason(gs_492, 0); DoCorrelation(gi_140, Correlation1, gia_544[1]); DoCorrelation(gi_144, Correlation2, gia_544[2]); DoCorrelation(gi_148, Correlation3, gia_544[3]); DoCorrelation(gi_152, Correlation4, gia_544[4]); } } } } } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void DoCorrelation(bool ai_0, string as_4, int ai_12) { double ld_16; RefreshInfor(); if (ai_12 < gi_540) { if (ai_0) { if (gi_532 == OP_BUY) OrderSend(as_4, OP_BUY, CheckLots(GetLot(ai_12, as_4)), MarketInfo(as_4, MODE_ASK), 3, 0, 0, "[" + Magic + "]黄金甲5B ;N." + gi_540, Magic, 0, Lime); else if (gi_532 == OP_SELL) OrderSend(as_4, OP_SELL, CheckLots(GetLot(ai_12, as_4)), MarketInfo(as_4, MODE_BID), 3, 0, 0, "[" + Magic + "]黄金甲5B ;N." + gi_540, Magic, 0, Red); } else { if (gi_532 == OP_SELL) OrderSend(as_4, OP_BUY, CheckLots(GetLot(ai_12, as_4)), MarketInfo(as_4, MODE_ASK), 3, 0, 0, "[" + Magic + "]黄金甲5B ;N." + gi_540, Magic, 0, Lime); else if (gi_532 == OP_BUY) OrderSend(as_4, OP_SELL, CheckLots(GetLot(ai_12, as_4)), MarketInfo(as_4, MODE_BID), 3, 0, 0, "[" + Magic + "]黄金甲5B ;N." + gi_540, Magic, 0, Red); } } else { if (CheckTotal12() && gi_540 > 0) { if (gd_524 <= 10.0 * (-gd_508) * GetLossPoint(gi_540)) { ld_16 = CheckLots(GetLot(gi_540, Main)); if (gd_508 < MaxLots) { if (CheckOrder) { if (gi_532 == OP_BUY && GetTrend() > 0) OrderSend(Main, OP_BUY, ld_16, MarketInfo(Main, MODE_ASK), 3, 0, 0, "[" + Magic + "]黄金甲5B ;N." + ((gi_540 + 1)), Magic, 0, Lime); else if (gi_532 == OP_SELL && GetTrend() < 0) OrderSend(Main, OP_SELL, ld_16, MarketInfo(Main, MODE_BID), 3, 0, 0, "[" + Magic + "]黄金甲5B ;N." + ((gi_540 + 1)), Magic, 0, Red); } else { if (gi_532 == OP_BUY) OrderSend(Main, OP_BUY, ld_16, MarketInfo(Main, MODE_ASK), 3, 0, 0, "[" + Magic + "]黄金甲5B ;N." + ((gi_540 + 1)), Magic, 0, Lime); else if (gi_532 == OP_SELL) OrderSend(Main, OP_SELL, ld_16, MarketInfo(Main, MODE_BID), 3, 0, 0, "[" + Magic + "]黄金甲5B ;N." + ((gi_540 + 1)), Magic, 0, Red); } } } } } } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int CheckTotal12() { bool li_0 = TRUE; for (int li_4 = 1; li_4 < ArraySize(gia_544); li_4++) { if (gia_544[li_4] != gi_540) { li_0 = FALSE; break; } } return (li_0); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int GetTrend() { int li_0 = 0; double ld_4 = iMA(Symbol(), TimeFrame, 5, 0, MODE_LWMA, PRICE_CLOSE, li_0); double ld_12 = iMA(Symbol(), TimeFrame, 5, 0, MODE_LWMA, PRICE_CLOSE, li_0 + 1); double ld_20 = iMA(Symbol(), TimeFrame, 10, 0, MODE_LWMA, PRICE_CLOSE, li_0); double ld_28 = iMA(Symbol(), TimeFrame, 10, 0, MODE_LWMA, PRICE_CLOSE, li_0 + 1); double ld_36 = iMA(Symbol(), TimeFrame, 20, 0, MODE_LWMA, PRICE_CLOSE, li_0); double ld_44 = iMA(Symbol(), TimeFrame, 20, 0, MODE_LWMA, PRICE_CLOSE, li_0 + 1); if (ld_4 > ld_12 && ld_20 > ld_28 && ld_36 > ld_44) return (1); if (ld_4 < ld_12 && ld_20 < ld_28 && ld_36 < ld_44) return (-1); return (0); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int GetTrend2() { if (MainDirection == 1) return (1); if (MainDirection == 2) return (-1); int li_0 = 0; double ld_4 = iMA(Symbol(), TimeFrame2, 5, 0, MODE_LWMA, PRICE_CLOSE, li_0); double ld_12 = iMA(Symbol(), TimeFrame2, 5, 0, MODE_LWMA, PRICE_CLOSE, li_0 + 1); double ld_20 = iMA(Symbol(), TimeFrame2, 10, 0, MODE_LWMA, PRICE_CLOSE, li_0); double ld_28 = iMA(Symbol(), TimeFrame2, 10, 0, MODE_LWMA, PRICE_CLOSE, li_0 + 1); double ld_36 = iMA(Symbol(), TimeFrame2, 20, 0, MODE_LWMA, PRICE_CLOSE, li_0); double ld_44 = iMA(Symbol(), TimeFrame2, 20, 0, MODE_LWMA, PRICE_CLOSE, li_0 + 1); if (ld_4 > ld_12 && ld_20 > ld_28 && ld_36 > ld_44) return (1); if (ld_4 < ld_12 && ld_20 < ld_28 && ld_36 < ld_44) return (-1); return (0); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int SetReason(string as_0, double ad_8) { GlobalVariableSet(as_0, ad_8); if (GlobalVariableGet(as_0) != ad_8) Alert("EA:Close Error ! Reason=" + DoubleToStr(ad_8, 0)); return (GlobalVariableGet(as_0)); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int GetReason(string as_0) { int li_8 = GlobalVariableGet(as_0); return (li_8); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void RefreshInfor() { gd_508 = 0; gd_516 = 0; gd_524 = 0; gi_536 = 0; gi_540 = 0; gi_548 = 0; for (int li_0 = 0; li_0 < ArraySize(gia_544); li_0++) gia_544[li_0] = 0; gi_532 = -1; int li_4 = 0; for (li_0 = 0; li_0 < OrdersTotal(); li_0++) { if (OrderSelect(li_0, SELECT_BY_POS, MODE_TRADES) != FALSE) { gi_536++; if (OrderMagicNumber() == Magic) { if (OrderType() == OP_BUY || OrderType() == OP_SELL) { gd_508 += OrderLots(); gd_524 += OrderProfit(); if (OrderSymbol() == Main) gi_540++; if (OrderSymbol() == Correlation1) { gia_544[1]++; gi_548++; } if (OrderSymbol() == Correlation2) { gia_544[2]++; gi_548++; } if (OrderSymbol() == Correlation3) { gia_544[3]++; gi_548++; } if (OrderSymbol() == Correlation4) { gia_544[4]++; gi_548++; } if (OrderTicket() > li_4 && OrderSymbol() == Main) { li_4 = OrderTicket(); gd_516 = OrderLots(); gi_532 = OrderType(); } } } } } } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void DoCloseAll() { bool li_4; bool li_8; for (int li_0 = 0; li_0 < OrdersTotal(); li_0++) { RefreshRates(); li_4 = OrderSelect(li_0, SELECT_BY_POS, MODE_TRADES); if (li_4) { if (OrderType() == OP_BUY || OrderType() == OP_SELL) { li_8 = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 3, Blue); if (li_8) PlaySound(gs_476); } } } } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void DoCloseMagic() { bool li_4; bool li_8; for (int li_0 = 0; li_0 < OrdersTotal(); li_0++) { RefreshRates(); li_4 = OrderSelect(li_0, SELECT_BY_POS, MODE_TRADES); if (li_4) { if (OrderMagicNumber() == Magic) { if (OrderType() == OP_BUY || OrderType() == OP_SELL) { li_8 = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 3, Blue); if (li_8) PlaySound(gs_476); } } } } } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ double CheckLots(double ad_0) { double ld_8 = 0; ld_8 = NormalizeDouble(ad_0 / MarketInfo(Main, MODE_LOTSTEP), 0); ld_8 *= MarketInfo(Main, MODE_LOTSTEP); ld_8 = MathMax(ld_8, MarketInfo(Symbol(), MODE_MINLOT)); return (ld_8); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void DrawLabel(string as_0, string as_8, int ai_16, color ai_20) { if (ObjectFind(as_0) != 0) { ObjectDelete(as_0); ObjectCreate(as_0, OBJ_LABEL, 0, 0, 0); ObjectSet(as_0, OBJPROP_CORNER, 0); ObjectSet(as_0, OBJPROP_XDISTANCE, 2); ObjectSet(as_0, OBJPROP_YDISTANCE, ai_16); } ObjectSetText(as_0, as_8, 9, "Arial", ai_20); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void ShowInfor() { RefreshInfor(); int li_0 = 20; int li_4 = 15; string ls_8 = "Lable_Name1"; string ls_16 = "Current Profit: " + DoubleToStr(gd_524, 2); if (gd_524 > 0.0) DrawLabel(ls_8, ls_16, li_0, Red); else DrawLabel(ls_8, ls_16, li_0, Lime); li_0 += li_4; ls_8 = "Lable_Name2"; ls_16 = "WinPoint Price: " + DoubleToStr(10.0 * gd_508 * WinPoint, 2); DrawLabel(ls_8, ls_16, li_0, DeepPink); li_0 += li_4; ls_8 = "Lable_Name3"; ls_16 = "TakeProfit: " + DoubleToStr(TakeProfit, 2); DrawLabel(ls_8, ls_16, li_0, DeepPink); li_0 += li_4; ls_8 = "Lable_Name4"; ls_16 = "StopLoss: " + DoubleToStr(StopLoss, 2); DrawLabel(ls_8, ls_16, li_0, Lime); li_0 += li_4; ls_8 = "Lable_Name5"; ls_16 = "NowLot: " + DoubleToStr(gd_508, 2); DrawLabel(ls_8, ls_16, li_0, DeepPink); li_0 += li_4; ls_8 = "Lable_Name6"; ls_16 = "MaxLots: " + DoubleToStr(MaxLots, 2); DrawLabel(ls_8, ls_16, li_0, DeepPink); li_0 += li_4; ls_8 = "Lable_Name7"; ls_16 = "Level: " + DoubleToStr(gi_540, 0); DrawLabel(ls_8, ls_16, li_0, DeepPink); li_0 += li_4; ls_8 = "Lable_Name8"; ls_16 = "LossPoint : " + DoubleToStr(GetLossPoint(gi_540), 0); DrawLabel(ls_8, ls_16, li_0, DeepPink); li_0 += li_4; ls_8 = "Lable_Name9"; if (TwoWay) ls_16 = "TwoWay : True"; else ls_16 = "TwoWay : False"; DrawLabel(ls_8, ls_16, li_0, DeepPink); li_0 += li_4; ls_8 = "Lable_Name11"; ls_16 = "NextOrderPrice : " + DoubleToStr(10.0 * (gd_508 * GetLossPoint(gi_540)), 2); DrawLabel(ls_8, ls_16, li_0, Lime); li_0 += li_4; ls_8 = "Lable_Name12"; ls_16 = "Magic : " + Magic; DrawLabel(ls_8, ls_16, li_0, DeepPink); li_0 += li_4; if (gd_508 >= MaxLots) { ls_8 = "Lable_NameAlert"; ls_16 = "Alert: Maxlots ! Maxlots !!"; if (ObjectFind(ls_8) < 0) Alert(ls_16); DrawLabel(ls_8, ls_16, li_0, Red); li_0 += li_4; return; } ObjectDelete("Lable_NameAlert"); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ double GetLossPoint(int ai_0) { int li_4 = ai_0; if (li_4 == 0) return (99999999); if (li_4 == 1) return (LossPoint1); if (li_4 == 2) return (LossPoint2); if (li_4 == 3) return (LossPoint3); if (li_4 == 4) return (LossPoint4); if (li_4 == 5) return (LossPoint5); if (li_4 == 6) return (LossPoint6); if (li_4 == 7) return (LossPoint7); if (li_4 == 8) return (LossPoint8); if (li_4 == 9) return (LossPoint9); if (li_4 == 10) return (LossPoint10); if (li_4 == 11) return (LossPoint11); if (li_4 == 12) return (LossPoint12); if (li_4 == 13) return (LossPoint13); if (li_4 == 14) return (LossPoint14); if (li_4 == 15) return (LossPoint15); if (li_4 == 16) return (LossPoint16); if (li_4 == 17) return (LossPoint17); if (li_4 == 18) return (LossPoint18); if (li_4 == 19) return (LossPoint19); if (li_4 == 20) return (LossPoint20); return (LossPoint20); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ double GetLot(int ai_0, string as_4) { double ld_24; double ld_12 = LotNo20; int li_20 = ai_0 + 1; if (li_20 == 1) ld_12 = LotNo1; if (li_20 == 2) ld_12 = LotNo2; if (li_20 == 3) ld_12 = LotNo3; if (li_20 == 4) ld_12 = LotNo4; if (li_20 == 5) ld_12 = LotNo5; if (li_20 == 6) ld_12 = LotNo6; if (li_20 == 7) ld_12 = LotNo7; if (li_20 == 8) ld_12 = LotNo8; if (li_20 == 9) ld_12 = LotNo9; if (li_20 == 10) ld_12 = LotNo10; if (li_20 == 11) ld_12 = LotNo11; if (li_20 == 12) ld_12 = LotNo12; if (li_20 == 13) ld_12 = LotNo13; if (li_20 == 14) ld_12 = LotNo14; if (li_20 == 15) ld_12 = LotNo15; if (li_20 == 16) ld_12 = LotNo16; if (li_20 == 17) ld_12 = LotNo17; if (li_20 == 18) ld_12 = LotNo18; if (li_20 == 19) ld_12 = LotNo19; if (li_20 == 20) ld_12 = LotNo20; if (OrderValue) { ld_24 = MarketInfo(as_4, MODE_BID); if (ld_24 > 0.0) { if (ld_24 < 10.0) ld_12 = 1 / ld_24 * ld_12; else ld_12 = 100 / ld_24 * ld_12; } } return (ld_12); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int LastType() { int li_0 = 0; int li_4 = -1; for (int li_8 = 0; li_8 < OrdersHistoryTotal(); li_8++) { if (OrderSelect(li_8, SELECT_BY_POS, MODE_HISTORY) != FALSE) { if (OrderMagicNumber() == Magic) { if (OrderType() == OP_BUY || OrderType() == OP_SELL) { if (li_0 < OrderTicket() && OrderSymbol() == Main) { li_0 = OrderTicket(); li_4 = OrderType(); } } } } } return (li_4); } //+------------------------------------------------------------------+