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

my millions ea.mq4

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

ea robofibo source v.11.2.mq4MetaTrader 4 · 1 общих теговᴇɴᴛʀʏ.txtTradingView · 1 общих теговzonestrategy.mqhMetaTrader 5 · 1 общих теговxauusd_simple_strategy7.mq4MetaTrader 4 · 1 общих теговxauusd_grok_presisi_scalper_v1.4 - anti detach.mq5MetaTrader 5 · 1 общих теговxauusd_gold_perfect.mq4MetaTrader 4 · 1 общих тегов
Вы автор или правообладатель?

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

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

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

#include <stdlib.mqh>
#include <stderror.mqh>
#define  NL    "\n"

extern string  _Account_Settings_      = "Set your Account info";
extern int     InitialAccount          = 50; 
extern int     GMTOffset               = 0;    //0=Broker GMT.
extern string  TradeComment            = "";
extern string  MoneyManagementset      = "Set your trading tolerance";
extern double  Portion                 = 1;      // Portion of account you want to trade on this pair
extern bool    UseEquityProtection     = false;   // Close all orders when negative Float is excessive.
extern double  FloatPercent            = 100;     // Percent of portion for max Float level.
extern bool    UsePowerOutSL           = true;   // Set to protect from internet loss
extern bool    MoneyMangement          = false;   // will autocalculate lot size, lot increment and profit target
extern double  MaximumRisk             = 5;    // equals 4% or .04 of account balance for base lot
extern double  LotSize                 = 0.1;
extern double  LotIncrement            = 0;   // must be set to .01 or greater
extern int     Slippage                = 5;      // Tolerance for opening and closing of orders
extern string  _Piplite_EA_Set_        = "Set trade parameters";
extern double  ProfitTarget            = 1;      // All orders closed when this profit target amount (in dollars) is reached
extern double  ProfitSkew              = 50;      // Increase/decrease ProfitTarget when MoneyMangement=true
extern int     ProfitMode              = 1;      // 1= mixed mode, 2= global mode, 3= split mode, 1 is best
extern bool    ProfitTrailing          = true;   // Will try to allow profit grow beyond ProfitTarget
extern double  MaxRetrace              = 2;      // Maximum percent of MaxProfit allowed to decrease before close all orders
extern bool    ReverseDirection        = false;   // true = will trade long when price is low and short and price is high. false = will trade long when price is high and short when price is low
extern bool    UseARSI                 = false;   // Adaptive RSI For Trade Entry
extern int     RSI_period              = 30;     // TF for ARSI
extern int     ima_bars                = 10;     // length of ARSI
extern double  ARSI_trigger            = 0.008;  // level to trigger trade.  Set to 0 for ATR to trigger entry
extern bool    Use_MARSI_Cross         = true;  // Helps to prevent multiple trades in Trending Market
extern double  RSIMA_MA_Period         = 10;     // Best Period
extern double  RSIMA_RSI_Period        = 14;     // Best Period
extern bool    TrendProtect            = false;
extern double  Window                  = 40.0;   // Window to define ranging market  
extern bool    Use_Entry_Delay         = true;  // Helps reduce draw down by stopping new entries if number of seconds not passed
extern double  Minimum_Entry_Delay     = 300;   // Number of seconds to wait before re-entries
extern bool    AutoSpacing             = true;   // Spacing will be calculated using StDev
extern int     StDevTF                 = 60;     // TF for StDev
extern int     StDevPer                = 12;     // lenght of StDev
extern int     StDevMode               = 3;      // mode of StDev - 0=SMA, 1=EMA, 2=SMMA, 3=LWMA 
extern int     Spacing                 = 60;     // Minimum distance of orders placed against the trend of the initial order, In effect only if AutoSpacing=false
extern int     TrendSpacing            = 1;   // Minimum distance of orders placed with the trend of the initial order (set to 1000 to disable )
extern string  _Day_Time_Set_          = "Set days and time to trade";
extern bool    UseTradeTime            = false;
extern int     TradeHourStart          = 0;
extern int     TradeHourEnd            = 24;
extern bool    Sunday                  = true;
extern bool    Monday                  = true;
extern bool    Tuesday                 = true;
extern bool    Wednesday               = true;
extern bool    Thursday                = true;
extern bool    Friday                  = true;
extern bool    NFP_Friday              = false;
extern double  DayPeriod               = 5;
extern double  hedgecarpan             =1.5;
extern double  StopLoss                =20;
extern double Baccount                 =100000000;

int            Accounttype             = 0;
int            TradeStart;
int            TradeEnd;
double         stoploss                = 0;
int            slip                    = 0;
int            Error                   = 0;
int            Order                   = 0;
int            Reference               = 0;
double         TickPrice               = 0;
bool           TradeShort              = true;           //Allow placing of sell ordes
bool           TradeLong               = true;           //Allow placing of buy orders
int            OpenOnTick              = 0;
int            MaxBuys                 = 0;
int            MaxSells                = 0;
double         MaxProfit               = 0;
int            lotPrecision;
double         POSL;
int            count;
bool           TradeAllowed            = true;
double         PortionBalance, PortionEquity;
int            BrokerDecimal           = 1;
string         POSL_On                 = "No";
double         buysl, sellsl;      
int            MaximumBuyOrders        = 3;
int            MaximumSellOrders       = 3;
double         SL                      = 20;     // Performs better with no initial stoploss. 
double GECAL=1;
double GECSAT;
double LastProfit=0,LastProfit1=0;
double LotFactor=1;
double LProfitTarget =50;

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

int deinit(){
   Comment("Waiting for data tick.......................... ");
   ObjectsDeleteAll(0, OBJ_LABEL);   
   return (0);
}

void CalculateLotPrecision(){
   double lotstep=MarketInfo(Symbol(),MODE_LOTSTEP);
   if(lotstep==1) lotPrecision=0;
   if(lotstep==0.1) lotPrecision=1;
   if(lotstep==0.01) lotPrecision=2;
   if(lotstep==0.001) lotPrecision=3;
}

double AutoLot()
  {
   double lot;

   lot=NormalizeDouble(Accounttype*((AccountBalance()/10000)*(MaximumRisk/100))/Portion,lotPrecision);

   if(lot<0.01) lot=0.01;
   if(lot < MarketInfo(Symbol(),MODE_MINLOT)) lot = MarketInfo(Symbol(),MODE_MINLOT);
   if(lot>5.88 && Accounttype == 1) lot=5.88;
   if(lot>2.94 && Accounttype == 10) lot=2.94;

   return(lot);
  }

void PlaceBuyOrder()
{
   double BuyOrders, Lots;
   double LowestBuy = 1000, HighestBuy;

   TickPrice = 0;

   RefreshRates();

   for (Order = OrdersTotal() - 1; Order >= 0; Order--)
   {
      if (OrderSelect(Order, SELECT_BY_POS, MODE_TRADES))
      {
         if (OrderSymbol() == Symbol() && OrderMagicNumber() == Reference && OrderType() == OP_BUY)
         {
            if (OrderOpenPrice() < LowestBuy) LowestBuy = OrderOpenPrice();
            if (OrderOpenPrice() > HighestBuy) HighestBuy = OrderOpenPrice();
            BuyOrders++;
         }
      }
   }

   Lots = NormalizeDouble(LotSize + (LotIncrement * BuyOrders * LotFactor), lotPrecision);

   if(BuyOrders==0) Lots = NormalizeDouble(LotSize, lotPrecision);

   if (Lots == 0) Lots = NormalizeDouble(LotSize, lotPrecision);

   if(IsTradeAllowed()==true  && (BuyOrders < MaximumBuyOrders))
   {
      if (SL == 0) stoploss = 0; 
      else stoploss = Ask - ((SL*BrokerDecimal) * Point);

			if(-1 == OrderSend(Symbol(), OP_BUY, Lots, Ask, Slippage, stoploss, 0, TradeComment, Reference, 0, Green))
				Print("Error opening BUY order: " + ErrorDescription(GetLastError()) + " (C" + GetLastError() + ")  Ask:" + Ask + "  Slippage:" + Slippage);
			else TickPrice = Close[0];
   }
/*
   Error = GetLastError();
   if (Error != 0)
      Print("Error opening BUY order: " + ErrorDescription(Error) + " (C" + Error + ")  Ask:" + Ask + "  Slippage:" + Slippage);
   else
   {
      TickPrice = Close[0];
   }
*/
}

void PlaceSellOrder()
{
   double SellOrders, Lots;
   double HighestSell, LowestSell = 1000;

   TickPrice = 0;

   RefreshRates();

   for (Order = OrdersTotal() - 1; Order >= 0; Order--)
   {
      if (OrderSelect(Order, SELECT_BY_POS, MODE_TRADES))
      {
         if (OrderSymbol() == Symbol() && OrderMagicNumber() == Reference && OrderType() == OP_SELL)
         {
            if (OrderOpenPrice() > HighestSell) HighestSell = OrderOpenPrice();
            if (OrderOpenPrice() < LowestSell) LowestSell = OrderOpenPrice();
            SellOrders++;
         }
      }
   }

   Lots = NormalizeDouble(LotSize + (LotIncrement * SellOrders*LotFactor), lotPrecision);

   if(SellOrders==0) Lots = NormalizeDouble(LotSize, lotPrecision);

   if (Lots == 0) Lots = NormalizeDouble(LotSize, lotPrecision);

   if(IsTradeAllowed()==true && (SellOrders < MaximumSellOrders))
   {  
      if (SL == 0) stoploss = 0; 
      else stoploss = Bid + ((SL*BrokerDecimal) * Point); 

			if(-1 == OrderSend(Symbol(), OP_SELL, Lots, Bid, Slippage, stoploss, 0, TradeComment, Reference, 0, Red))
				Print("Error opening SELL order: " + ErrorDescription(GetLastError()) + " (D" + GetLastError() + ")  Bid:" + Bid + "  Slippage:" + Slippage);
			else TickPrice = Close[0];
   }
/*  
   Error = GetLastError();
   if (Error != 0)
      Print("Error opening SELL order: " + ErrorDescription(Error) + " (D" + Error + ")  Bid:" + Bid + "  Slippage:" + Slippage);
   else
   {
      TickPrice = Close[0];
   }
*/
}

void CloseAllBuyProfit()
{
int spread=MarketInfo(Symbol(),MODE_SPREAD);
   for(int i = OrdersTotal()-1; i >=0; i--)
       {
       OrderSelect(i, SELECT_BY_POS);
       bool result = false;
       if (OrderSymbol()==Symbol() && OrderMagicNumber() == Reference && OrderType() == OP_BUY)  
         {

           if (TimeCurrent()-OrderOpenTime() >=20) result = OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_BID), Slippage, Aqua );
         }
       }

  return; 
}

void CloseAllSellProfit()
{
int spread=MarketInfo(Symbol(),MODE_SPREAD);
   for(int i = OrdersTotal()-1; i >=0; i--)
      {
      OrderSelect(i, SELECT_BY_POS);
      bool result = false;
      if (OrderSymbol()==Symbol() && OrderMagicNumber() == Reference && OrderType() == OP_SELL) 
       {

         if (TimeCurrent()-OrderOpenTime() >=20) result = OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_ASK), Slippage, Lime );
       }
     }

  return; 
}

int start()
{
      // код доступен только после оплаты
   }
   if(MoneyMangement){LotSize=AutoLot();
      if(LotIncrement>0) LotIncrement=LotSize;}
   int            Session = 1;
   double         TotalProfit=0; 
   double         TotalOrders=0;
   double         TotalLots=0; 
   double         MarginPercent;
   static double  LowMarginPercent = 10000000, LowEquity = 10000000;
   double         BuyPipTarget, SellPipTarget;
   int            SellOrders, BuyOrders;
   double         BuyPips, SellPips, BuyLots, SellLots;
   double         LowestBuy = 999, HighestBuy = 0.0001, LowestSell = 999, HighestSell = 0.0001, HighPoint, MidPoint, LowPoint;
   double         Profit = 0, BuyProfit = 0, SellProfit = 0, PosBuyProfit = 0, PosSellProfit = 0;
   int            HighestBuyTicket, LowestBuyTicket, HighestSellTicket, LowestSellTicket;
   double         HighestBuyProfit, LowestBuyProfit, HighestSellProfit, LowestSellProfit;
   bool           SELLme = false;
   bool           BUYme = false;
   double         Margin = MarketInfo(Symbol(), MODE_MARGINREQUIRED);
   string         Message;
   bool           ProfitTargetReached = false; 
   datetime       LastOrderDateTime = 0;
   bool           EntryAllowed = true;  // can be used anywhere in start code to disable new entries for any reason
   int timehr,timemin;      

   for (Order = OrdersTotal() - 1; Order >= 0; Order--)
   {
      if (OrderSelect(Order, SELECT_BY_POS, MODE_TRADES))
      {
         if (OrderSymbol() == Symbol() && OrderMagicNumber() == Reference)
         {

            if (OrderOpenTime() > LastOrderDateTime)
               LastOrderDateTime= OrderOpenTime();

            Profit = OrderProfit() + OrderSwap() + OrderCommission();

            if (OrderType() == OP_BUY)
            {
               if (OrderOpenPrice() >= HighestBuy)
               {
                  HighestBuy = OrderOpenPrice();
                  HighestBuyTicket = OrderTicket();
                  HighestBuyProfit = Profit;
               }

               if (OrderOpenPrice() <= LowestBuy)
               {
                  LowestBuy = OrderOpenPrice();
                  LowestBuyTicket = OrderTicket();
                  LowestBuyProfit = Profit;
               }

               BuyOrders++;
               if (BuyOrders > MaxBuys) MaxBuys = B

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

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

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

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

Стоимость полного кода: 2 017 ₽