← К каталогу
Исходный код · ID 3684

escort_trend_strategy_m0002.mq4

Похожие материалы по тегам

xauusd_gold_perfect.mq4MetaTrader 4 · 1 общих теговtm sniper pro.txtTradingView · 1 общих теговsource code of grid with 100 pips stop loss.mq4MetaTrader 4 · 1 общих теговsniper pro.mq5MetaTrader 5 · 1 общих теговpro +.txtTradingView · 1 общих теговofada_gold_trader_v230.mq5MetaTrader 5 · 1 общих тегов
Вы автор или правообладатель?

Сообщите нам, если считаете, что материал размещён без разрешения.

Получить полный код

Поиск по коду файла

#property version   "1.0"
#property strict

extern string s1="Risk MM and parameters orders";
extern double      MM_Lots            = 0.1;    // lot size when disconnecting MM
extern int         MM_Mode            = 1;      // 0 MM disabled enabled 1 
extern double      RiskPercent        = 1;      // percentage of the risk position of the deposit and stoploss
extern int         LotsDecimal        = 1;      // Number of decimal places
extern double      LotExponent        = 1.0;    // koefitsient increase lot series
extern int         MaxTrade           = 0;      // the maximum number of warrants in Series
extern int         MagicNumber        = 149101; // magic number (helps distinguish its adviser on foreign orders)

extern string s2="Trading options";
extern double      TakeProfit         = 200;    // takeprofit 
extern double      StopLoss           = 55;     // Stop Loss
extern double      TrailStop          = 35;     // the level of the beginning of work bezubytka treylingstopa
extern double      TrailStep          = 3;      // step treylingstopa
extern int         Trailing           = 1;      // Use treylingstopa (0 - not used)
extern int         Breakeven          = 1;      // We translate stoploss to breakeven and then Tralee (0 - immediately Tralee)

extern string s3="Signals Indicators";
extern int         PorogBar           = 3;      // Max bar graph when the signals should coincide
extern double      PorogCCI           = 100;    // The threshold of the entrance to the position of CCI
extern int         FastIMA            = 8;      // MA period
extern int         SlowIMA            = 18;     // MA period
extern int         PerICCI            = 14;     // CCI period
extern int         FastMACD           = 8;      // MACD period
extern int         SlowMACD           = 18;     // MACD period

extern bool        ShowTableOnTesting=TRUE;   // display information table

bool Sg_MACD_Buy= False,Sg_MACD_Sell = False;
bool Sg_IMA_Buy = False,Sg_IMA_Sell = False;
bool Sg_ICCI_Buy,Sg_ICCI_Sell;
bool OrderBuy=False,OrderSell=False;

double StopLevel,Spread;
double SignalFastiMA,SignalSlowiMA,SignalCCI;
double MacdCurr,MacdPrev,SignalCurr,SignalPrev;
double Lots,TP,SL;
double MaxLots,MinLots,LotStep,LotOrder;
double PunktSize;

int Slip=3.0,LotCount=0,NumerBar=0;
int total,ticket;
datetime timeprev=0;

string s="Escort_TS_m0002 : ";

int OnInit()
  {
      // код доступен только после оплаты
   }

void OnDeinit(const int reason)
  {
   ObjectsDeleteAll();
  }

void OnTick()
  {
      // код доступен только после оплаты
   }

   if(MM_Mode==0 || StopLoss==0) Lots=MM_Lots;
   else
     {
      Lots=NormalizeDouble((AccountBalance()*RiskPercent/100.0)/(PunktSize*StopLoss),LotsDecimal);
      if(Lots < MinLots) Lots = MinLots;
      if(Lots > MaxLots) Lots = MaxLots;
     }

   Spread=MarketInfo(Symbol(),MODE_SPREAD)*Point;
   StopLevel=MarketInfo(Symbol(),MODE_STOPLEVEL);
   Sg_ICCI_Buy  = FALSE;
   Sg_ICCI_Sell = FALSE;

   total=CountTrades();

   if(total==0)
     {

      MacdCurr   = iMACD(NULL,0,FastMACD,SlowMACD,9,PRICE_TYPICAL,MODE_MAIN,0);
      MacdPrev   = iMACD(NULL,0,FastMACD,SlowMACD,9,PRICE_TYPICAL,MODE_MAIN,1);

      SignalFastiMA = iMA(Symbol(),NULL,FastIMA,0,MODE_LWMA,PRICE_WEIGHTED,0);
      SignalSlowiMA = iMA(Symbol(),NULL,SlowIMA,0,MODE_LWMA,PRICE_WEIGHTED,0);

      SignalCCI=iCCI(Symbol(),NULL,PerICCI,PRICE_TYPICAL,0);

      if(!Sg_IMA_Buy && (SignalSlowiMA<SignalFastiMA))
        {                     // Determine the input of IMA 1st step
         Sg_IMA_Buy=TRUE;
         Sg_IMA_Sell=FALSE;
         timeprev = Time[0];
         NumerBar = 1;
        }
      if(!Sg_IMA_Sell && (SignalSlowiMA>SignalFastiMA))
        {
         Sg_IMA_Sell= TRUE;
         Sg_IMA_Buy = FALSE;
         timeprev = Time[0];
         NumerBar = 1;
        }

      if((timeprev!=Time[0]) && (Sg_IMA_Buy || Sg_ICCI_Sell))
        {
         timeprev=Time[0];
         if(NumerBar!=0) NumerBar++;
        }

      if(NumerBar>PorogBar)
        {
         Sg_IMA_Sell= FALSE;
         Sg_IMA_Buy = FALSE;
         NumerBar=0;
        }

      if(!Sg_MACD_Buy  && Sg_IMA_Buy  && (MacdCurr > 0 && MacdPrev < 0)) Sg_MACD_Buy  = TRUE;
      if(!Sg_MACD_Sell && Sg_IMA_Sell && (MacdCurr < 0 && MacdPrev > 0)) Sg_MACD_Sell = TRUE;

      if(SignalCCI>PorogCCI *1) Sg_ICCI_Buy=TRUE;                       // We determine the moment of entry of CCI Step 3
      if(SignalCCI<PorogCCI*-1) Sg_ICCI_Sell=TRUE;

      if(Sg_MACD_Buy && Sg_IMA_Buy && Sg_ICCI_Buy)
        {                            // Open order Buy
         LotOrder=CalcOrdersLot(Lots,LotExponent,MaxLots,MaxTrade);
         ticket=OrderSend(Symbol(),OP_BUY,LotOrder,Ask,Slip,0,0,s+IntegerToString(LotCount+1),MagicNumber,0,Blue);
         if(ticket<0)
           {
            Print("Error: ",GetLastError());
            return;
              } else {
            OrderBuy=TRUE;
            Sg_MACD_Buy= FALSE;
            Sg_IMA_Buy = FALSE;
            NumerBar=0;
           }
        }

      if(OrderBuy)
        {

         TP = NormalizeDouble(Bid + MathMax(TakeProfit, StopLevel)*Point, Digits);
         SL = NormalizeDouble(Bid - MathMax(StopLoss, StopLevel)*Point, Digits);
         if(!OrderModify(ticket,OrderOpenPrice(),SL,TP,0))
           {
            Print("Error: ",GetLastError());
            return;
           }
         OrderBuy=FALSE;
     

Показано первые 50% кода (символов: 7891)

Что вы получите после оплаты

На этой странице откроется полный исходный код файла вместо ознакомительного фрагмента.

Чтобы оформить заказ, введите email и перейдите к оплате.

Стоимость полного кода
789₽