10评论

3收藏

变色龙EA源码-网格EA的代表作

avatar cruel | 2935 人阅读 | 10 人评论 | 2018-05-23

变色龙EA源码-网格EA的代表作
Chameleon-EA.rar 售价: 2 枚金币 (一共需要4个金币)
""
还没有人打赏,支持一下

评论|共 10 个

qq_大海_jfK

发表于 2019-10-10 22:44:18 来自手机 | 显示全部楼层

#include <WinUser32.mqh>  extern string RENEGADEFX = "------RENEGADE FX.COM------"; extern bool DisplayInfo = TRUE; extern string TRADING_Options = "--- TRADING LOGIC OPTIONS ---"; extern string MoleOptions = "---------MOLE OPTIONS--------"; extern bool EnableMoleLogic = FALSE; extern bool EnableMoleCloseLogic = TRUE; extern bool StopTradeOnReversal = FALSE; extern int MoleChartTimeFrame = 1440; extern string StorkOptions = "---------STORK OPTIONS-------"; extern bool EnableStorkLogic = FALSE; extern string TokyoExpressOptions = "----TOKYO EXPRESS OPTIONS----"; extern bool EnableTokyoExpressLogic = FALSE; extern string MagicNumbers = "--------MAGIC NUMBERS--------"; extern int MagicNumberLong = 111111; extern int MagicNumberShrt = 111111; extern int EquityMagicNumber = 111111; extern string TRADING_Inputs = "--- TRADING INPUTS ---"; extern double LotsLong = 0.25; extern double LotsShrt = 0.25; extern int Slippage = 3; extern int ProfitTargetLong = 0; extern int ProfitTargetShrt = 0; extern int StopLossLong = 0; extern int StopLossShrt = 0; extern int TrailingStartLong = 0; extern int TrailingStopLong = 0; extern int TrailingStartShrt = 0; extern int TrailingStopShrt = 0; extern int MaxTradesLong = 1; extern int MaxTradesShrt = 1; extern int MaxTrades = 2; extern string DirectionalFilters = " ---DIRECTIONAL FILTERS---"; extern bool OnlyUpOrDownLong = FALSE; extern bool OnlyUpOrDownShrt = FALSE; extern string RSI_Inputs = "----- RSI INPUTS -----"; extern int Shift = 0; extern int RSI_TimeFrameLong = 240; extern int RSI_PeriodsLong = 12; extern int RSI_TimeFrameShrt = 240; extern int RSI_PeriodsShrt = 12; extern double RSI_Buy_Level = 50.0; extern double RSI_Sell_Level = 50.0; extern int ThresholdLong = 50; extern int ThresholdShrt = 50; extern string PSAR_Inputs = "----- DYNAMIC TRAILING STOP -----"; extern bool UsePSARTrailingLong = FALSE; extern bool UsePSARTrailingShrt = FALSE; extern int PSARTIMEFRAMELong = 1440; extern double PSARStepLong = 0.005; extern double PSARMaxLong = 0.2; extern int PSARTIMEFRAMEShrt = 240; extern double PSARStepShrt = 0.005; extern double PSARMaxShrt = 0.2; extern string RetraceRSI_Inputs = "----RETRACE FILTERS ----"; extern bool RetraceFilterLong = FALSE; extern bool RetraceFilterShrt = FALSE; extern int LongPeriods = 3; extern int LongTimeFrame = 60; extern int ShortPeriods = 2; extern int ShortTimeFrame = 60; extern string BreakoutFilters = "-----BREAKOUT FILTERS-----"; extern bool bLevelFilterLong = FALSE; extern double bLowerLevelLong = 0.0; extern double bUpperLevelLong = 0.0; extern bool bLevelFilterShrt = FALSE; extern double bLowerLevelShrt = 0.0; extern double bUpperLevelShrt = 0.0; extern string RangeFilters = "-----RANGE FILTERS-----"; extern bool rLevelFilterLong = FALSE; extern double rLowerLevelLong = 0.0; extern double rUpperLevelLong = 0.0; extern bool rLevelFilterShrt = FALSE; extern double rLowerLevelShrt = 0.0; extern double rUpperLevelShrt = 0.0; extern string EquityManagement = "--- EQUITY MANAGEMENT --"; extern bool UseMagicNumber = TRUE; extern bool UseSymbol = TRUE; extern double EquityProfitTarget = 125.0; extern double EquityStopLoss = 0.0; extern double EquityTrailing = 0.0; extern double EquityTrailStart = 0.0; extern string MoneyManagements = "---MONEY MANAGEMENT---"; extern bool MoneyManagement = FALSE; extern bool BrokerAllowsFractionalLots = TRUE; extern bool BrokerAllows5Digits = FALSE; extern double Risk = 0.25; extern string Martingale = "----- MARTINGALE HEDGE FEATURE -----"; extern bool UseStandardHedge = FALSE; extern bool MgHedgeLong = TRUE; extern bool MgHedgeShort = TRUE; extern int PipsDownLong = 50; extern int PipsDownShort = 50; extern int LongMagicNumberToHedge = 111111; extern int ShortMagicNumberToHedge = 111111; extern int MgStopLossLong = 0; extern int MgStopLossShort = 0; extern int MgTakeProfitLong = 0; extern int MgTakeProfitShort = 0; extern double MgLotsMultiplier = 1.25; extern int MgMaxTrades = 500; extern int MgMagicNumber = 111111; extern int MgTrailingStart = 0; extern int MgTrailingStop = 0; extern string caors = "----- CLOSE ALL ON REVERSAL -----"; extern bool CloseAllOnReversal = FALSE; extern int caorLongPeriods = 20; extern int caorLongTimeFrame = 60; extern int caorShortPeriods = 10; extern int caorShortTimeFrame = 60; extern double caorSignalReadPeriod = 5.0; int gi_676 = 0; int gi_680 = 0; int gi_unused_684 = 0; int gi_688 = 1; int gi_692 = 0; double gd_696 = 0.0; double gd_704 = 0.0; int gi_unused_712 = 0; int gi_unused_716 = 0;  int init() {    if (IsTesting()) HideTestIndicators(TRUE);    GlobalVariableSet(StringConcatenate(MagicNumberLong, Symbol(), " - Chameleon LastAnchorLong"), MarketInfo(Symbol(), MODE_ASK));    GlobalVariableSet(StringConcatenate(MagicNumberShrt, Symbol(), " - Chameleon LastAnchorShort"), MarketInfo(Symbol(), MODE_BID));    gi_692 = MarketInfo(Symbol(), MODE_SPREAD);    int l_mb_code_0 = 0;    switch (UninitializeReason()) {    case REASON_ACCOUNT:       l_mb_code_0 = MessageBox("You just switched accounts! \n Do you want to run the EA on this account as well?", "Warning", MB_YESNO);       if (l_mb_code_0 != IDYES) return (-1);    case REASON_PARAMETERS:       GlobalVariableSet(StringConcatenate(MagicNumberLong, Symbol(), " - Chameleon LastAnchorLong"), MarketInfo(Symbol(), MODE_ASK));       GlobalVariableSet(StringConcatenate(MagicNumberShrt, Symbol(), " - Chameleon LastAnchorShort"), MarketInfo(Symbol(), MODE_BID));    case REASON_CHARTCHANGE:    case REASON_CHARTCLOSE:    case REASON_RECOMPILE:       break;    }    Comment("");    int li_unused_8 = Time[0];    if (BrokerAllows5Digits) gi_688 = 10;    return (0); }  int deinit() {    Comment("");    return (0); }  int start() {    int li_0;    double ld_4;    double ld_12;    double l_irsi_20;    double l_irsi_28;    double l_irsi_36;    string l_dbl2str_44;    double ld_52;    double ld_60;    double l_irsi_68;    double l_irsi_76;    int li_unused_84 = Time[0];    int li_88 = 0;    int li_92 = 0;    int li_96 = 0;    double l_ima_100 = iMA(NULL, MoleChartTimeFrame, 3, 0, MODE_EMA, PRICE_CLOSE, 1);    double l_ima_108 = iMA(NULL, MoleChartTimeFrame, 11, 0, MODE_EMA, PRICE_HIGH, 1);    double l_ima_116 = iMA(NULL, MoleChartTimeFrame, 3, 0, MODE_EMA, PRICE_CLOSE, 0);    double l_ima_124 = iMA(NULL, MoleChartTimeFrame, 11, 0, MODE_EMA, PRICE_LOW, 1);    double l_ima_132 = l_ima_100;    double l_ima_140 = l_ima_124;    double l_ima_148 = l_ima_116;    double l_ima_156 = l_ima_124;    double l_ima_164 = l_ima_100;    double l_ima_172 = l_ima_108;    double l_ima_180 = l_ima_116;    double l_ima_188 = l_ima_108;    double l_ima_196 = l_ima_100;    double l_ima_204 = l_ima_108;    double l_ima_212 = l_ima_116;    double l_ima_220 = l_ima_108;    double l_ima_228 = l_ima_100;    double l_ima_236 = l_ima_124;    double l_ima_244 = l_ima_116;    double l_ima_252 = l_ima_124;    double l_istochastic_260 = iStochastic(NULL, PERIOD_D1, 5, 3, 3, MODE_SMA, 0, MODE_MAIN, 0);    double l_istochastic_268 = iStochastic(NULL, PERIOD_D1, 5, 3, 3, MODE_SMA, 0, MODE_SIGNAL, 0);    double l_istochastic_276 = iStochastic(NULL, PERIOD_H4, 5, 3, 3, MODE_SMA, 0, MODE_MAIN, 0);    double l_istochastic_284 = iStochastic(NULL, PERIOD_H4, 5, 3, 3, MODE_SMA, 0, MODE_SIGNAL, 0);    double l_istochastic_292 = iStochastic(NULL, PERIOD_H1, 5, 3, 3, MODE_SMA, 0, MODE_MAIN, 0);    double l_istochastic_300 = iStochastic(NULL, PERIOD_H1, 5, 3, 3, MODE_SMA, 0, MODE_SIGNAL, 0);    double l_istochastic_308 = iStochastic(NULL, PERIOD_M15, 5, 3, 3, MODE_SMA, 0, MODE_MAIN, 1);    double l_istochastic_316 = iStochastic(NULL, PERIOD_M15, 5, 3, 3, MODE_SMA, 0, MODE_SIGNAL, 1);    double l_istochastic_324 = iStochastic(NULL, PERIOD_D1, 5, 3, 3, MODE_SMA, 0, MODE_MAIN, 0);    double l_istochastic_332 = iStochastic(NULL, PERIOD_D1, 5, 3, 3, MODE_SMA, 0, MODE_SIGNAL, 0);    double l_istochastic_340 = iStochastic(NULL, PERIOD_H4, 5, 3, 3, MODE_SMA, 0, MODE_MAIN, 0);    double l_istochastic_348 = iStochastic(NULL, PERIOD_H4, 5, 3, 3, MODE_SMA, 0, MODE_SIGNAL, 0);    double l_istochastic_356 = iStochastic(NULL, PERIOD_H1, 5, 3, 3, MODE_SMA, 0, MODE_MAIN, 0);    double l_istochastic_364 = iStochastic(NULL, PERIOD_H1, 5, 3, 3, MODE_SMA, 0, MODE_SIGNAL, 0);    double l_istochastic_372 = iStochastic(NULL, PERIOD_M15, 5, 3, 3, MODE_SMA, 0, MODE_MAIN, 1);    double l_istochastic_380 = iStochastic(NULL, PERIOD_M15, 5, 3, 3, MODE_SMA, 0, MODE_SIGNAL, 1);    TrailingAllLong(TrailingStartLong, TrailingStopLong, MagicNumberLong, ThresholdLong);    TrailingAllShrt(TrailingStartShrt, TrailingStopShrt, MagicNumberShrt, ThresholdShrt);    if (UsePSARTrailingLong) TrailingAllPSARLong(TrailingStopLong, MagicNumberLong, ThresholdLong, PSARTIMEFRAMELong, PSARStepLong, PSARMaxLong);    if (UsePSARTrailingShrt) TrailingAllPSARShrt(TrailingStopShrt, MagicNumberShrt, ThresholdShrt, PSARTIMEFRAMEShrt, PSARStepShrt, PSARMaxShrt);    if (MoneyManagement) {       LotsLong = MM(Symbol(), Risk, MoneyManagement, BrokerAllowsFractionalLots);       LotsShrt = MM(Symbol(), Risk, MoneyManagement, BrokerAllowsFractionalLots);    }    double ld_388 = 0.0;    double ld_396 = CalcProfit(Symbol(), MagicNumberLong, MagicNumberShrt, EquityMagicNumber, UseMagicNumber, UseSymbol);    if (EquityProfitTarget != 0.0)       if (ld_396 >= EquityProfitTarget) CloseAllOrders(Symbol(), MagicNumberLong, MagicNumberShrt, EquityMagicNumber, UseMagicNumber, UseSymbol);    if (EquityStopLoss != 0.0)       if (ld_396 <= 0 - EquityStopLoss) CloseAllOrders(Symbol(), MagicNumberLong, MagicNumberShrt, EquityMagicNumber, UseMagicNumber, UseSymbol);    double ld_404 = NormalizeDouble(100.0 * (ld_396 / AccountBalance()), 2);    if (GlobalVariableCheck(MagicNumberLong + "CHAMELEON-START-TRAIL") == FALSE) gd_696 = 0.0;    if (EquityTrailStart > 0.0 && EquityTrailing > 0.0 && ld_404 > EquityTrailStart) {       gd_704 = ld_404 - EquityTrailing;       if (gd_704 > gd_696) gd_696 = gd_704;       if (gd_696 > 0.0) GlobalVariableSet(MagicNumberLong + "CHAMELEON-START-TRAIL", gd_696);    }    if (ld_404 > 0.0 && ld_404 < gd_696 && gd_696 != 0.0) {       CloseAllOrders(Symbol(), MagicNumberLong, MagicNumberShrt, EquityMagicNumber, UseMagicNumber, UseSymbol);       GlobalVariableDel(MagicNumberLong + "CHAMELEON-START-TRAIL");    }    if (EnableMoleLogic && EnableMoleCloseLogic && l_ima_196 >= l_ima_204 && l_ima_212 <= l_ima_220) {       li_92 = 3;       CloseAllLongs(Symbol(), MagicNumberLong);    }    if (CountLongs(Symbol(), MagicNumberLong) < MaxTradesLong && CountAll(Symbol(), MagicNumberLong, MagicNumberShrt, EquityMagicNumber, UseMagicNumber, UseSymbol) < MaxTrades) {       ld_4 = 0.0;       ld_12 = 0.0;       l_irsi_20 = iRSI(NULL, RSI_TimeFrameLong, RSI_PeriodsLong, PRICE_CLOSE, Shift);       l_irsi_28 = iRSI(NULL, LongTimeFrame, LongPeriods, PRICE_CLOSE, Shift);       l_irsi_36 = iRSI(NULL, ShortTimeFrame, ShortPeriods, PRICE_CLOSE, Shift);       if (l_irsi_20 <= 0.0 || l_irsi_28 <= 0.0 || l_irsi_36 <= 0.0) return (0);       if ((!bLevelFilterLong && !rLevelFilterLong) || (rLevelFilterLong && Bid > rLowerLevelLong && Ask < rUpperLevelLong) || (bLevelFilterLong && Bid < bLowerLevelLong ||          Ask > bUpperLevelLong)) {          li_88 = 0;          if (EnableMoleLogic && l_ima_132 <= l_ima_140 && l_ima_148 >= l_ima_156) li_92 = 1;          if (EnableStorkLogic && l_istochastic_260 >= l_istochastic_268 && l_istochastic_276 >= l_istochastic_284 && l_istochastic_292 >= l_istochastic_300 && l_istochastic_308 >= l_istochastic_316) li_88 = 1;          if (!StopTradeOnReversal || l_ima_116 > l_ima_124 && !EnableMoleLogic || li_92 == 1 && !EnableStorkLogic || li_88 == 1 && (EnableTokyoExpressLogic && l_irsi_20 <= RSI_Buy_Level) ||             (!EnableTokyoExpressLogic && l_irsi_20 >= RSI_Buy_Level) && gi_680 != -1 || !CloseAllOnReversal) {             if (CheckTrade(Symbol(), MagicNumberLong, ThresholdLong, OP_BUY)) {                ld_12 = MarketInfo(Symbol(), MODE_ASK) - GlobalVariableGet(StringConcatenate(MagicNumberLong, Symbol(), " - Chameleon LastAnchorLong"));                ld_4 = GlobalVariableGet(StringConcatenate(MagicNumberLong, Symbol(), " - Chameleon LastAnchorLong")) - MarketInfo(Symbol(), MODE_ASK);                if (ld_12 >= ThresholdLong * Point * gi_688) {                   if (CheckTrade(Symbol(), MagicNumberLong, ThresholdLong, OP_BUY)) {                      li_0 = EnterLong(LotsLong, ProfitTargetLong, StopLossLong, MagicNumberLong);                      if (li_0 > 0) GlobalVariableSet(StringConcatenate(MagicNumberLong, Symbol(), " - Chameleon LastAnchorLong"), MarketInfo(Symbol(), MODE_ASK));                   }                } else {                   if (!OnlyUpOrDownLong) {                      if (ld_4 >= ThresholdLong * Point * gi_688) {                         if (RetraceFilterLong) {                            if (l_irsi_36 > l_irsi_28) {                               if (CheckTrade(Symbol(), MagicNumberLong, ThresholdLong, OP_BUY)) {                                  li_0 = EnterLong(LotsLong, ProfitTargetLong, StopLossLong, MagicNumberLong);                                  if (li_0 > 0) GlobalVariableSet(StringConcatenate(MagicNumberLong, Symbol(), " - Chameleon LastAnchorLong"), MarketInfo(Symbol(), MODE_ASK));                               }                            }                         } else {                            if (CheckTrade(Symbol(), MagicNumberLong, ThresholdLong, OP_BUY)) {                               li_0 = EnterLong(LotsLong, ProfitTargetLong, StopLossLong, MagicNumberLong);                               if (li_0 > 0) GlobalVariableSet(StringConcatenate(MagicNumberLong, Symbol(), " - Chameleon LastAnchorLong"), MarketInfo(Symbol(), MODE_ASK));                            }                         }                      }                   }                }             }          }       }    }    if (EnableMoleLogic && EnableMoleCloseLogic && l_ima_228 <= l_ima_236 && l_ima_244 >= l_ima_252) {       li_96 = 4;       CloseAllShrts(Symbol(), MagicNumberShrt);    }    if (CountShorts(Symbol(), MagicNumberShrt) < MaxTradesShrt && CountAll(Symbol(), MagicNumberLong, MagicNumberShrt, EquityMagicNumber, UseMagicNumber, UseSymbol) < MaxTrades) {       l_irsi_20 = iRSI(NULL, RSI_TimeFrameShrt, RSI_PeriodsShrt, PRICE_CLOSE, Shift);       l_irsi_28 = iRSI(NULL, LongTimeFrame, LongPeriods, PRICE_CLOSE, Shift);       l_irsi_36 = iRSI(NULL, ShortTimeFrame, ShortPeriods, PRICE_CLOSE, Shift);       if ((!bLevelFilterShrt && !rLevelFilterShrt) || (rLevelFilterShrt && Bid > rLowerLevelShrt && Ask < rUpperLevelShrt) || (bLevelFilterShrt && Bid < bLowerLevelShrt ||          Ask > bUpperLevelShrt)) {          if (EnableMoleLogic && l_ima_164 >= l_ima_172 && l_ima_180 <= l_ima_188) li_96 = 2;          if (EnableStorkLogic && l_istochastic_324 <= l_istochastic_332 && l_istochastic_340 <= l_istochastic_348 && l_istochastic_356 <= l_istochastic_364 && l_istochastic_372 <= l_istochastic_380) li_88 = 2;          if (!StopTradeOnReversal || l_ima_116 < l_ima_108 && !EnableMoleLogic || li_96 == 2 && !EnableStorkLogic || li_88 == 2 && (EnableTokyoExpressLogic && l_irsi_20 >= RSI_Sell_Level) ||             (!EnableTokyoExpressLogic && l_irsi_20 <= RSI_Sell_Level) && gi_680 != 1 || !CloseAllOnReversal) {             if (CheckTrade(Symbol(), MagicNumberShrt, ThresholdShrt, OP_SELL)) {                ld_12 = GlobalVariableGet(StringConcatenate(MagicNumberShrt, Symbol(), " - Chameleon LastAnchorShort")) - MarketInfo(Symbol(), MODE_BID);                ld_4 = MarketInfo(Symbol(), MODE_BID) - GlobalVariableGet(StringConcatenate(MagicNumberShrt, Symbol(), " - Chameleon LastAnchorShort"));                if (ld_12 >= ThresholdShrt * Point * gi_688) {                   if (CheckTrade(Symbol(), MagicNumberShrt, ThresholdShrt, OP_SELL)) {                      li_0 = EnterShort(LotsShrt, ProfitTargetShrt, StopLossShrt, MagicNumberShrt);                      if (li_0 > 0) GlobalVariableSet(StringConcatenate(MagicNumberShrt, Symbol(), " - Chameleon LastAnchorShort"), MarketInfo(Symbol(), MODE_BID));                   }                } else {                   if (!OnlyUpOrDownShrt) {                      if (ld_4 >= ThresholdShrt * Point * gi_688) {                         if (RetraceFilterShrt) {                            if (l_irsi_36 < l_irsi_28) {                               if (CheckTrade(Symbol(), MagicNumberShrt, ThresholdShrt, OP_SELL)) {                                  li_0 = EnterShort(LotsShrt, ProfitTargetShrt, StopLossShrt, MagicNumberShrt);                                  if (li_0 > 0) GlobalVariableSet(StringConcatenate(MagicNumberShrt, Symbol(), " - Chameleon LastAnchorShort"), MarketInfo(Symbol(), MODE_BID));                               }                            }                         } else {                            if (CheckTrade(Symbol(), MagicNumberShrt, ThresholdShrt, OP_SELL)) {                               li_0 = EnterShort(LotsShrt, ProfitTargetShrt, StopLossShrt, MagicNumberShrt);                               if (li_0 > 0) GlobalVariableSet(StringConcatenate(MagicNumberShrt, Symbol(), " - Chameleon LastAnchorShort"), MarketInfo(Symbol(), MODE_BID));                            }                         }                      }                   }                }             }          }       }    }    if (MgHedgeLong || MgHedgeShort && CountAll(Symbol(), MagicNumberLong, MagicNumberShrt, EquityMagicNumber, UseMagicNumber, UseSymbol) > 0 && CountAll(Symbol(), MagicNumberLong, MagicNumberShrt, EquityMagicNumber, UseMagicNumber, UseSymbol) < MgMaxTrades) {       for (int l_pos_412 = OrdersTotal() - 1; l_pos_412 >= 0; l_pos_412--) {          OrderSelect(l_pos_412, SELECT_BY_POS, MODE_TRADES);          if (!UseSymbol || Symbol() == OrderSymbol()) {             l_dbl2str_44 = DoubleToStr(OrderTicket(), 0);             ld_388 = OrderLots() * MgLotsMultiplier;             if (CheckMgHedge(l_dbl2str_44, MgMagicNumber)) {                OrderSelect(l_pos_412, SELECT_BY_POS, MODE_TRADES);                ld_52 = NormalizeDouble((Bid - OrderOpenPrice()) / Point / gi_688, 0);                ld_60 = NormalizeDouble((OrderOpenPrice() - Ask) / Point / gi_688, 0);                if (ld_52 <= 0 - PipsDownLong && OrderType() == OP_BUY && OrderMagicNumber() == LongMagicNumberToHedge) {                   Wait();                   if (!UseStandardHedge) {                      if (MathAbs(Ask - Bid) / (Point * gi_688) >= gi_692 + Slippage) return (0);                      if (AccountFreeMarginCheck(Symbol(), OP_BUY, ld_388) <= 0.0) return (0);                      OrderSend(Symbol(), OP_BUY, ld_388, Ask, Slippage, StopLong(Ask, MgStopLossLong), TakeLong(Ask, MgTakeProfitLong), l_dbl2str_44, MgMagicNumber, 0, Green);                   } else {                      if (MathAbs(Ask - Bid) / (Point * gi_688) >= gi_692 + Slippage) return (0);                      if (AccountFreeMarginCheck(Symbol(), OP_SELL, ld_388) <= 0.0) return (0);                      OrderSend(Symbol(), OP_SELL, ld_388, Bid, Slippage, StopShort(Bid, MgStopLossShort), TakeShort(Bid, MgTakeProfitShort), l_dbl2str_44, MgMagicNumber, 0, Yellow);                   }                } else {                   if (ld_60 <= 0 - PipsDownShort && OrderType() == OP_SELL && OrderMagicNumber() == ShortMagicNumberToHedge) {                      Wait();                      if (UseStandardHedge) {                         if (MathAbs(Ask - Bid) / (Point * gi_688) >= gi_692 + Slippage) return (0);                         if (AccountFreeMarginCheck(Symbol(), OP_BUY, ld_388) <= 0.0) return (0);                         OrderSend(Symbol(), OP_BUY, ld_388, Ask, Slippage, StopLong(Ask, MgStopLossLong), TakeLong(Ask, MgTakeProfitLong), l_dbl2str_44, MgMagicNumber, 0, Green);                      } else {                         if (MathAbs(Ask - Bid) / (Point * gi_688) >= gi_692 + Slippage) return (0);                         if (AccountFreeMarginCheck(Symbol(), OP_BUY, ld_388) <= 0.0) return (0);                         OrderSend(Symbol(), OP_SELL, ld_388, Bid, Slippage, StopShort(Bid, MgStopLossShort), TakeShort(Bid, MgTakeProfitShort), l_dbl2str_44, MgMagicNumber, 0, Yellow);                      }                   }                }             }          }       }    }    if (CountAllm(Symbol(), MgMagicNumber) > 0) TrailingMg(MgTrailingStart, MgTrailingStop, MgMagicNumber);    int li_416 = Time[0];    if (CloseAllOnReversal && (li_416 - gi_676) / 60 >= caorSignalReadPeriod) {       gi_676 = li_416;       l_irsi_68 = iRSI(Symbol(), caorLongTimeFrame, caorLongPeriods, PRICE_CLOSE, 0);       l_irsi_76 = iRSI(Symbol(), caorShortTimeFrame, caorShortPeriods, PRICE_CLOSE, 0);       if (l_irsi_68 > 0.0 && l_irsi_76 > 0.0) {          if (l_irsi_76 < l_irsi_68) {             if (CountLongs(Symbol(), MagicNumberLong) > 0) CloseAllLongs(Symbol(), MagicNumberLong);             gi_680 = -1;          } else {             if (l_irsi_76 > l_irsi_68) {                if (CountShorts(Symbol(), MagicNumberShrt) > 0) CloseAllShrts(Symbol(), MagicNumberShrt);                gi_680 = 1;             }          }       }    }    if (DisplayInfo) PrintInfo(Symbol(), MagicNumberLong, MagicNumberShrt, EquityMagicNumber, UseMagicNumber, UseSymbol);    return (0); }  double CalcProfit(string a_symbol_0, int a_magic_8, int a_magic_12, int a_magic_16, bool ai_20, int ai_24) {    double ld_ret_28 = 0.0;    for (int l_pos_36 = OrdersTotal() - 1; l_pos_36 >= 0; l_pos_36--) {       OrderSelect(l_pos_36, SELECT_BY_POS, MODE_TRADES);       if (!ai_24 || OrderSymbol() == a_symbol_0) {          if (!ai_20) {             ld_ret_28 += OrderProfit();             ld_ret_28 += OrderSwap();          } else {             if (a_magic_16 != 0) {                if (a_magic_16 == OrderMagicNumber()) {                   ld_ret_28 += OrderProfit();                   ld_ret_28 += OrderSwap();                }             } else {                if (OrderMagicNumber() == a_magic_8 || OrderMagicNumber() == a_magic_12) {                   ld_ret_28 += OrderProfit();                   ld_ret_28 += OrderSwap();                }             }          }       }    }    return (ld_ret_28); }  double CalcProfitPrint(string a_symbol_0, int a_magic_8, int a_magic_12, int ai_unused_16, bool ai_20, int ai_24) {    double ld_ret_28 = 0.0;    for (int l_pos_36 = OrdersTotal() - 1; l_pos_36 >= 0; l_pos_36--) {       OrderSelect(l_pos_36, SELECT_BY_POS, MODE_TRADES);       if (!ai_24 || OrderSymbol() == a_symbol_0) {          if (!ai_20) {             ld_ret_28 += OrderProfit();             ld_ret_28 += OrderSwap();          } else {             if (OrderMagicNumber() == a_magic_8 || OrderMagicNumber() == a_magic_12) {                ld_ret_28 += OrderProfit();                ld_ret_28 += OrderSwap();             }          }       }    }    return (ld_ret_28); }  double EquityMagicNumberProfit(string a_symbol_0, int a_magic_8, bool ai_12, int ai_16) {    double ld_ret_20 = 0.0;    for (int l_pos_28 = OrdersTotal() - 1; l_pos_28 >= 0; l_pos_28--) {       OrderSelect(l_pos_28, SELECT_BY_POS, MODE_TRADES);       if (!ai_16 || OrderSymbol() == a_symbol_0) {          if (!ai_12) {             ld_ret_20 += OrderProfit();             ld_ret_20 += OrderSwap();          } else {             if (a_magic_8 != 0) {                if (a_magic_8 == OrderMagicNumber()) {                   ld_ret_20 += OrderProfit();                   ld_ret_20 += OrderSwap();                }             }          }       }    }    return (ld_ret_20); }  bool CheckMgHedge(string as_0, int a_magic_8) {    bool li_ret_12 = TRUE;    for (int l_pos_16 = OrdersTotal() - 1; l_pos_16 >= 0; l_pos_16--) {       OrderSelect(l_pos_16, SELECT_BY_POS, MODE_TRADES);       if (OrderMagicNumber() == a_magic_8)          if (OrderComment() == as_0) li_ret_12 = FALSE;    }    return (li_ret_12); }  void Wait() {    while (!IsTradeAllowed() || IsTradeContextBusy()) Sleep(100); }  int CountLongs(string a_symbol_0, int a_magic_8) {    int l_count_12 = 0;    for (int l_pos_16 = OrdersTotal() - 1; l_pos_16 >= 0; l_pos_16--) {       OrderSelect(l_pos_16, SELECT_BY_POS, MODE_TRADES);       if (OrderSymbol() == a_symbol_0) {          if (OrderMagicNumber() == a_magic_8)             if (OrderType() == OP_BUY) l_count_12++;       }    }    return (l_count_12); }  int CountShorts(string a_symbol_0, int a_magic_8) {    int l_count_12 = 0;    for (int l_pos_16 = OrdersTotal() - 1; l_pos_16 >= 0; l_pos_16--) {       OrderSelect(l_pos_16, SELECT_BY_POS, MODE_TRADES);       if (OrderSymbol() == a_symbol_0) {          if (OrderMagicNumber() == a_magic_8)             if (OrderType() == OP_SELL) l_count_12++;       }    }    return (l_count_12); }  int CountAllm(string a_symbol_0, int a_magic_8) {    int l_count_12 = 0;    for (int l_pos_16 = OrdersTotal() - 1; l_pos_16 >= 0; l_pos_16--) {       OrderSelect(l_pos_16, SELECT_BY_POS, MODE_TRADES);       if (OrderSymbol() == a_symbol_0) {          if (OrderMagicNumber() == a_magic_8) {             if (OrderType() == OP_BUY) l_count_12++;             else                if (OrderType() == OP_SELL) l_count_12++;          }       }    }    return (l_count_12); }  int CountAll(string a_symbol_0, int a_magic_8, int a_magic_12, int a_magic_16, bool ai_20, int ai_24) {    int l_count_28 = 0;    for (int l_pos_32 = OrdersTotal() - 1; l_pos_32 >= 0; l_pos_32--) {       OrderSelect(l_pos_32, SELECT_BY_POS, MODE_TRADES);       if (!ai_24 || OrderSymbol() == a_symbol_0) {          if (!ai_20) l_count_28++;          else {             if (a_magic_16 != 0) {                if (a_magic_16 == OrderMagicNumber()) l_count_28++;                else                   if (OrderMagicNumber() == a_magic_8 || OrderMagicNumber() == a_magic_12) l_count_28++;             }          }       }    }    return (l_count_28); }  int CountAllPrint(string a_symbol_0, int a_magic_8, int a_magic_12, int ai_unused_16, bool ai_20, int ai_24) {    int l_count_28 = 0;    for (int l_pos_32 = OrdersTotal() - 1; l_pos_32 >= 0; l_pos_32--) {       OrderSelect(l_pos_32, SELECT_BY_POS, MODE_TRADES);       if (!ai_24 || OrderSymbol() == a_symbol_0) {          if (!ai_20) l_count_28++;          else             if (OrderMagicNumber() == a_magic_8 || OrderMagicNumber() == a_magic_12) l_count_28++;       }    }    return (l_count_28); }  void CloseAllOrders(string a_symbol_0, int a_magic_8, int a_magic_12, int a_magic_16, bool ai_20, int ai_24) {    int l_cmd_28 = 0;    int li_unused_32 = 0;    while (CountAll(a_symbol_0, a_magic_8, a_magic_12, a_magic_16, ai_20, ai_24) > 0) {       for (int l_pos_36 = OrdersTotal() - 1; l_pos_36 >= 0; l_pos_36--) {          OrderSelect(l_pos_36, SELECT_BY_POS, MODE_TRADES);          if (!ai_24 || OrderSymbol() == a_symbol_0) {             if (!ai_20) {                l_cmd_28 = OrderType();                li_unused_32 = 0;                switch (l_cmd_28) {                case OP_BUY:                   Wait();                   li_unused_32 = OrderClose(OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_BID), 10, CLR_NONE);                   break;                case OP_SELL:                   Wait();                   li_unused_32 = OrderClose(OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_ASK), 10, CLR_NONE);                   break;                case OP_BUYLIMIT:                case OP_BUYSTOP:                case OP_SELLLIMIT:                case OP_SELLSTOP:                   Wait();                   li_unused_32 = OrderDelete(OrderTicket());                }             } else {                if (a_magic_16 != 0) {                   if (a_magic_16 == OrderMagicNumber()) {                      l_cmd_28 = OrderType();                      li_unused_32 = 0;                      switch (l_cmd_28) {                      case OP_BUY:                         Wait();                         li_unused_32 = OrderClose(OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_BID), 10, CLR_NONE);                         break;                      case OP_SELL:                         Wait();                         li_unused_32 = OrderClose(OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_ASK), 10, CLR_NONE);                         break;                      case OP_BUYLIMIT:                      case OP_BUYSTOP:                      case OP_SELLLIMIT:                      case OP_SELLSTOP:                         Wait();                         li_unused_32 = OrderDelete(OrderTicket());                      }                   }                } else {                   if (OrderMagicNumber() == a_magic_8 || OrderMagicNumber() == a_magic_12) {                      l_cmd_28 = OrderType();                      li_unused_32 = 0;                      switch (l_cmd_28) {                      case OP_BUY:                         Wait();                         li_unused_32 = OrderClose(OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_BID), 10, CLR_NONE);                         break;                      case OP_SELL:                         Wait();                         li_unused_32 = OrderClose(OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_ASK), 10, CLR_NONE);                         break;                      case OP_BUYLIMIT:                      case OP_BUYSTOP:                      case OP_SELLLIMIT:                      case OP_SELLSTOP:                         Wait();                         li_unused_32 = OrderDelete(OrderTicket());                      }                   }                }             }          }       }    }    GlobalVariableDel(a_magic_8 + "CHAMELEON-START-TRAIL"); }  void PrintInfo(string as_0, int ai_8, int ai_12, int ai_16, int ai_20, int ai_24) {    int li_28 = CountAllPrint(as_0, ai_8, ai_12, ai_16, ai_20, ai_24);    int li_32 = CountLongs(as_0, ai_8);    int li_36 = CountShorts(as_0, ai_12);    double ld_40 = CalcProfitPrint(as_0, ai_8, ai_12, ai_16, ai_20, ai_24);    double ld_48 = EquityMagicNumberProfit(as_0, ai_16, ai_20, ai_24);    if (IsTesting() == FALSE) {       Comment("Renegade Fx ",           "\nACCOUNT INFORMATION",           "\nAccount Name: ", AccountName(),           "\nAccount Number: ", AccountNumber(),           "\nLeverage: ", AccountLeverage(), ":1",           "\nMimimum Lot Size: ", MarketInfo(Symbol(), MODE_MINLOT),           "\nMaximum Lot Size: ", MarketInfo(Symbol(), MODE_MAXLOT),           "\nLot Size: $ ", MarketInfo(Symbol(), MODE_LOTSIZE),           "\nPip Value: $ ", MarketInfo(Symbol(), MODE_TICKVALUE),           "\nLot Step: ", MarketInfo(Symbol(), MODE_LOTSTEP),           "\nTRADE DATA",           "\nTotal trades: ", li_28,           "\nBuy trades: ", li_32,           "\nSell trades: ", li_36,           "\nOrder magic Long: ", ai_8,           "\nOrder magic Shrt: ", ai_12,           "\nEquityMagicNumber:", ai_16,           "\nPROFIT/LOSS STATS",           "\nBalance: ", AccountBalance(),           "\nEquity: ", AccountEquity(),           "\nAccount Profit: ", AccountProfit(),           "\n", Symbol(), " Profit: ", ld_40,        "\nEquityMagicNumberProfit:", ld_48);    } }  bool CheckTrade(string a_symbol_0, int a_magic_8, int ai_12, int a_cmd_16) {    for (int l_pos_20 = OrdersTotal() - 1; l_pos_20 >= 0; l_pos_20--) {       OrderSelect(l_pos_20, SELECT_BY_POS, MODE_TRADES);       if (OrderSymbol() == a_symbol_0) {          if (OrderMagicNumber() == a_magic_8) {             if (OrderType() == a_cmd_16 && a_cmd_16 == OP_BUY) {                if (MathAbs(NormalizeDouble(OrderOpenPrice(), 4) - NormalizeDouble(MarketInfo(a_symbol_0, MODE_ASK), 4)) > NormalizeDouble(ai_12 * MarketInfo(a_symbol_0, MODE_POINT) * gi_688, 4)) continue;                return (FALSE);             }             if (OrderType() == a_cmd_16 && a_cmd_16 == OP_SELL)                if (MathAbs(NormalizeDouble(OrderOpenPrice(), 4) - NormalizeDouble(MarketInfo(a_symbol_0, MODE_BID), 4)) <= NormalizeDouble(ai_12 * MarketInfo(a_symbol_0, MODE_POINT) * gi_688, 4)) return (FALSE);          }       }    }    return (TRUE); }  double StopLong(double ad_0, int ai_8) {    if (ai_8 == 0) return (0);    else return (ad_0 - ai_8 * Point * gi_688); }  double StopShort(double ad_0, int ai_8) {    if (ai_8 == 0) return (0);    else return (ad_0 + ai_8 * Point * gi_688); }  double TakeLong(double ad_0, int ai_8) {    if (ai_8 == 0) return (0);    else return (ad_0 + ai_8 * Point * gi_688); }  double TakeShort(double ad_0, int ai_8) {    if (ai_8 == 0) return (0);    else return (ad_0 - ai_8 * Point * gi_688); }  double MM(string a_symbol_0, double ad_8, int ai_16, int ai_20) {    double l_minlot_24 = MarketInfo(a_symbol_0, MODE_MINLOT);    double l_maxlot_32 = MarketInfo(a_symbol_0, MODE_MAXLOT);    double ld_40 = AccountLeverage();    double l_lotsize_48 = MarketInfo(a_symbol_0, MODE_LOTSIZE);    double l_lotstep_56 = MarketInfo(a_symbol_0, MODE_LOTSTEP);    double ld_64 = MathMin(AccountBalance(), AccountEquity());    int li_72 = 0;    double ld_ret_76 = 0.0;    if (l_lotstep_56 == 0.01) li_72 = 2;    if (l_lotstep_56 == 0.1) li_72 = 1;    if (ai_20 == 1) {       if (ai_16 == 1) {          ld_ret_76 = ld_64 * ad_8 / (l_lotsize_48 / ld_40);          ld_ret_76 = StrToDouble(DoubleToStr(ld_ret_76, li_72));          if (ld_ret_76 < l_minlot_24) ld_ret_76 = l_minlot_24;          if (ld_ret_76 > l_maxlot_32) ld_ret_76 = l_maxlot_32;       }       if (ai_16 == 0) {          if (ld_ret_76 < l_minlot_24) ld_ret_76 = l_minlot_24;          if (ld_ret_76 > l_maxlot_32) ld_ret_76 = l_maxlot_32;       }    }    if (ai_20 == 0) {       if (ai_16 == 1) {          ld_ret_76 = ld_64 * ad_8 / (l_lotsize_48 / ld_40);          ld_ret_76 = MathRound(ld_ret_76);          if (ld_ret_76 < l_minlot_24) ld_ret_76 = l_minlot_24;          if (ld_ret_76 > l_maxlot_32) ld_ret_76 = l_maxlot_32;       }       if (ai_16 == 0) {          if (ld_ret_76 < l_minlot_24) ld_ret_76 = l_minlot_24;          if (ld_ret_76 > l_maxlot_32) ld_ret_76 = l_maxlot_32;       }    }    return (ld_ret_76); }  int EnterLong(double ad_0, int ai_8, int ai_12, int a_magic_16) {    int l_ticket_20 = 0;    bool li_24 = FALSE;    double ld_28 = 0.0;    double ld_36 = 0.0;    if (MathAbs(Ask - Bid) / (Point * gi_688) >= gi_692 + Slippage) return (0);    if (AccountFreeMarginCheck(Symbol(), OP_BUY, ad_0) <= 0.0) return (0);    double l_maxlot_44 = MarketInfo(Symbol(), MODE_MAXLOT);    double ld_unused_52 = MarketInfo(Symbol(), MODE_MINLOT);    while (!li_24) {       ld_28 = ad_0 / l_maxlot_44;       if (ld_28 <= 1.0) {          Wait();          RefreshRates();          l_ticket_20 = OrderSend(Symbol(), OP_BUY, ad_0, Ask, Slippage, StopLong(Ask, ai_12), TakeLong(Ask, ai_8), 0, a_magic_16, 0, Blue);          if (l_ticket_20 >= 0) li_24 = TRUE;       } else {          for (int l_count_60 = 0; l_count_60 < ld_28; l_count_60++) {             ad_0 -= ld_36;             Wait();             RefreshRates();             l_ticket_20 = OrderSend(Symbol(), OP_BUY, ad_0 - l_maxlot_44 * (MathFloor(ld_28) - l_count_60), Ask, Slippage, StopLong(Ask, ai_12), TakeLong(Ask, ai_8), 0, a_magic_16, 0, Blue);             ld_36 = ad_0 - l_maxlot_44 * (MathFloor(ld_28) - l_count_60);          }          li_24 = TRUE;       }    }    return (l_ticket_20); }  int EnterShort(double ad_0, int ai_8, int ai_12, int a_magic_16) {    int l_ticket_20 = 0;    bool li_24 = FALSE;    double ld_28 = 0.0;    double ld_36 = 0.0;    if (MathAbs(Ask - Bid) / (Point * gi_688) >= gi_692 + Slippage) return (0);    if (AccountFreeMarginCheck(Symbol(), OP_SELL, ad_0) <= 0.0) return (0);    double l_maxlot_44 = MarketInfo(Symbol(), MODE_MAXLOT);    double ld_unused_52 = MarketInfo(Symbol(), MODE_MINLOT);    while (!li_24) {       ld_28 = ad_0 / l_maxlot_44;       if (ld_28 <= 1.0) {          Wait();          RefreshRates();          l_ticket_20 = OrderSend(Symbol(), OP_SELL, ad_0, Bid, Slippage, StopShort(Bid, ai_12), TakeShort(Bid, ai_8), 0, a_magic_16, 0, Red);          if (l_ticket_20 >= 0) li_24 = TRUE;       } else {          for (int l_count_60 = 0; l_count_60 < ld_28; l_count_60++) {             ad_0 -= ld_36;             Wait();             RefreshRates();             l_ticket_20 = OrderSend(Symbol(), OP_SELL, ad_0 - l_maxlot_44 * (MathFloor(ld_28) - l_count_60), Bid, Slippage, StopLong(Bid, ai_12), TakeLong(Bid, ai_8), 0, a_magic_16, 0, Red);             ld_36 = ad_0 - l_maxlot_44 * (MathFloor(ld_28) - l_count_60);          }          li_24 = TRUE;       }    }    return (l_ticket_20); }  void TrailingAllLong(int ai_0, int ai_4, int a_magic_8, int ai_unused_12) {    if (ai_4 > 0) {       for (int l_ord_total_16 = OrdersTotal(); l_ord_total_16 >= 0; l_ord_total_16--) {          OrderSelect(l_ord_total_16, SELECT_BY_POS, MODE_TRADES);          if (OrderSymbol() == Symbol() && OrderMagicNumber() == a_magic_8) {             Print("Ticket ", OrderTicket(), " modified.");             if (OrderType() == OP_BUY) {                if (Bid - OrderOpenPrice() >= ai_0 * Point * gi_688)                   if (OrderStopLoss() < Bid - Point * gi_688 * ai_4) OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * gi_688 * ai_4, OrderTakeProfit(), 0, LightBlue);             }          }       }    } }  void TrailingAllShrt(int ai_0, int ai_4, int a_magic_8, int ai_unused_12) {    if (ai_4 > 0) {       for (int l_ord_total_16 = OrdersTotal(); l_ord_total_16 >= 0; l_ord_total_16--) {          OrderSelect(l_ord_total_16, SELECT_BY_POS, MODE_TRADES);          if (OrderSymbol() == Symbol() && OrderMagicNumber() == a_magic_8) {             Print("Ticket ", OrderTicket(), " modified.");             if (OrderType() == OP_SELL) {                if (OrderOpenPrice() - Ask >= ai_0 * Point * gi_688)                   if (OrderStopLoss() > Ask + Point * gi_688 * ai_4 || OrderStopLoss() == 0.0) OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * gi_688 * ai_4, OrderTakeProfit(), 0, LightPink);             }          }       }    } }  void TrailingAllPSARLong(int ai_unused_0, int a_magic_4, int ai_unused_8, int a_timeframe_12, double ad_16, double ad_24) {    double l_price_32 = NormalizeDouble(iSAR(Symbol(), a_timeframe_12, ad_16, ad_24, 1), MarketInfo(Symbol(), MODE_DIGITS));    if (l_price_32 > 0.0) {       for (int l_ord_total_40 = OrdersTotal(); l_ord_total_40 >= 0; l_ord_total_40--) {          OrderSelect(l_ord_total_40, SELECT_BY_POS, MODE_TRADES);          if (OrderSymbol() == Symbol() && OrderMagicNumber() == a_magic_4) {             if (OrderType() == OP_BUY)                if (OrderStopLoss() < l_price_32 && l_price_32 <= iLow(Symbol(), a_timeframe_12, 1)) OrderModify(OrderTicket(), OrderOpenPrice(), l_price_32, OrderTakeProfit(), 15128749);          }       }    } }  void TrailingAllPSARShrt(int ai_unused_0, int a_magic_4, int ai_unused_8, int a_timeframe_12, double ad_16, double ad_24) {    double l_price_32 = NormalizeDouble(iSAR(Symbol(), a_timeframe_12, ad_16, ad_24, 1), MarketInfo(Symbol(), MODE_DIGITS));    if (l_price_32 > 0.0) {       for (int l_ord_total_40 = OrdersTotal(); l_ord_total_40 >= 0; l_ord_total_40--) {          OrderSelect(l_ord_total_40, SELECT_BY_POS, MODE_TRADES);          if (OrderSymbol() == Symbol() && OrderMagicNumber() == a_magic_4) {             if (OrderType() == OP_SELL)                if (OrderStopLoss() > l_price_32 || OrderStopLoss() == 0.0 && l_price_32 >= iHigh(Symbol(), a_timeframe_12, 1)) OrderModify(OrderTicket(), OrderOpenPrice(), l_price_32, OrderTakeProfit(), 12695295);          }       }    } }  void TrailingMg(int ai_0, int ai_4, int a_magic_8) {    if (ai_4 > 0) {       for (int l_ord_total_12 = OrdersTotal(); l_ord_total_12 >= 0; l_ord_total_12--) {          OrderSelect(l_ord_total_12, SELECT_BY_POS, MODE_TRADES);          if (OrderSymbol() == Symbol() && OrderMagicNumber() == a_magic_8) {             if (OrderType() == OP_SELL) {                if (OrderOpenPrice() - Ask >= ai_0 * Point * gi_688)                   if (OrderStopLoss() > Ask + Point * gi_688 * ai_4 || OrderStopLoss() == 0.0) OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * gi_688 * ai_4, OrderTakeProfit(), 0, LightPink);             }             if (OrderType() == OP_BUY) {                if (Bid - OrderOpenPrice() >= ai_0 * Point * gi_688)                   if (OrderStopLoss() < Bid - Point * gi_688 * ai_4) OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * gi_688 * ai_4, OrderTakeProfit(), 0, LightBlue);             }          }       }    } }  void CloseAllLongs(string a_symbol_0, int a_magic_8) {    int l_cmd_12;    int li_unused_16;    int li_unused_20 = 0;    for (int l_pos_24 = OrdersTotal() - 1; l_pos_24 >= 0; l_pos_24--) {       OrderSelect(l_pos_24, SELECT_BY_POS, MODE_TRADES);       if (OrderSymbol() == a_symbol_0) {          if (OrderMagicNumber() == a_magic_8) {             l_cmd_12 = OrderType();             li_unused_16 = 0;             switch (l_cmd_12) {             case OP_BUY:                Wait();                li_unused_16 = OrderClose(OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_BID), 10, CLR_NONE);                break;             case OP_SELL: break;             case OP_BUYLIMIT:                Wait();                li_unused_16 = OrderDelete(OrderTicket());                break;             case OP_BUYSTOP:                Wait();                li_unused_16 = OrderDelete(OrderTicket());             case OP_SELLLIMIT: break;             case OP_SELLSTOP: break;             }          }       }    } }  void CloseAllShrts(string a_symbol_0, int a_magic_8) {    int l_cmd_12;    int li_unused_16;    int li_unused_20 = 0;    for (int l_pos_24 = OrdersTotal() - 1; l_pos_24 >= 0; l_pos_24--) {       OrderSelect(l_pos_24, SELECT_BY_POS, MODE_TRADES);       if (OrderSymbol() == a_symbol_0) {          if (OrderMagicNumber() == a_magic_8) {             l_cmd_12 = OrderType();             li_unused_16 = 0;             switch (l_cmd_12) {             case OP_BUY: break;                break;             case OP_SELL:                Wait();                li_unused_16 = OrderClose(OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_ASK), 10, CLR_NONE);                break;             case OP_BUYLIMIT: break;             case OP_BUYSTOP: break;             case OP_SELLLIMIT:                Wait();                li_unused_16 = OrderDelete(OrderTicket());                break;             case OP_SELLSTOP:                Wait();                li_unused_16 = OrderDelete(OrderTicket());             }          }       }    } }

当爆仓成为习惯

发表于 2019-10-10 23:11:54 | 显示全部楼层

法拉利

发表于 2020-6-12 21:40:16 | 显示全部楼层

难得一见的好帖

vivi

发表于 2020-7-21 16:04:41 | 显示全部楼层

帮你顶下哈!!

烟花易冷

发表于 2020-8-29 14:22:08 | 显示全部楼层

学习了,不错

小溪

发表于 2020-11-8 12:19:10 | 显示全部楼层

海还是海

发表于 2020-11-15 17:27:20 | 显示全部楼层

谢谢

liujian101

发表于 2021-7-21 12:29:11 | 显示全部楼层

初学外汇

发表于 2021-7-26 16:23:54 | 显示全部楼层

顶下

12下一页
您需要登录后才可以回帖 登录 | 注册 微信登录

EA之家评论守则