← Назад к списку файлов

currency xmeter_multimeter ea.mq4

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

extern string    IBFX_mini_account   = "=== Is your account an IBFX mini? ===";
extern bool AccountIsIBFXmini        = false;

extern string    Trade_parameters    = "=== Trade parameters ===";
extern double    Lot                 =            1.0;  // Lot size
extern int       Slippage            =            2;  // Slippage

extern string    Lot_size_management = "=== Lot size management ===";
extern bool      ManagedLotSize      =         false;  // If true, lot size based on the free margin
extern double    Risk                =          2.0;  // Risk to protect the equity
extern int       MaxLot              =         10.0;  // Maximum lot size

extern string    Pairs_To_Trade      = "=== How many pairs to trade? ===";
extern double    PairsToTrade        =          12.0;

extern string    Trade_EUR_USD       = "=== Do you want to trade EURUSD? ===";
extern bool      EUR_USD             =         true;
extern double    HighLevel_EURUSD    =          7.0;  // Level to reach for 1st condition become true
extern double    LowLevel_EURUSD     =          2.0;  // Level to not exceed for 2nd condition become true
extern double    TakeProfit_EURUSD   =         10.0;  // Profit for the order opened
extern double    StopLoss_EURUSD     =         10.0;  // StopLoss
extern int       MaxSpread_EURUSD    =         10.0;

extern string    Trade_GBP_USD       = "=== Do you want to trade GBPUSD? ===";
extern bool      GBP_USD             =         true;
extern double    HighLevel_GBPUSD    =          7.0;  // Level to reach for 1st condition become true
extern double    LowLevel_GBPUSD     =          2.0;  // Level to not exceed for 2nd condition become true
extern double    TakeProfit_GBPUSD   =         10.0;  // Profit for the order opened
extern double    StopLoss_GBPUSD     =         10.0;  // StopLoss
extern int       MaxSpread_GBPUSD    =         10.0;

extern string    Trade_AUD_USD       = "=== Do you want to trade AUDUSD? ===";
extern bool      AUD_USD             =         true;
extern double    HighLevel_AUDUSD    =          7.0;  // Level to reach for 1st condition become true
extern double    LowLevel_AUDUSD     =          2.0;  // Level to not exceed for 2nd condition become true
extern double    TakeProfit_AUDUSD   =         10.0;  // Profit for the order opened
extern double    StopLoss_AUDUSD     =         10.0;  // StopLoss
extern int       MaxSpread_AUDUSD    =         10.0;

extern string    Trade_USD_JPY       = "=== Do you want to trade USDJPY? ===";
extern bool      USD_JPY             =         true;
extern double    HighLevel_USDJPY    =          7.0;  // Level to reach for 1st condition become true
extern double    LowLevel_USDJPY     =          2.0;  // Level to not exceed for 2nd condition become true
extern double    TakeProfit_USDJPY   =         10.0;  // Profit for the order opened
extern double    StopLoss_USDJPY     =         10.0;  // StopLoss
extern int       MaxSpread_USDJPY    =         10.0;

extern string    Trade_USD_CHF       = "=== Do you want to trade USDCHF? ===";
extern bool      USD_CHF             =          true;
extern double    HighLevel_USDCHF    =          7.0;  // Level to reach for 1st condition become true
extern double    LowLevel_USDCHF     =          2.0;  // Level to not exceed for 2nd condition become true
extern double    TakeProfit_USDCHF   =         10.0;  // Profit for the order opened
extern double    StopLoss_USDCHF     =         10.0;  // StopLoss
extern int       MaxSpread_USDCHF    =         10.0;

extern string    Trade_USD_CAD       = "=== Do you want to trade USDCAD? ===";
extern bool      USD_CAD             =          true;
extern double    HighLevel_USDCAD    =          7.0;  // Level to reach for 1st condition become true
extern double    LowLevel_USDCAD     =          2.0;  // Level to not exceed for 2nd condition become true
extern double    TakeProfit_USDCAD   =         10.0;  // Profit for the order opened
extern double    StopLoss_USDCAD     =         10.0;  // StopLoss
extern int       MaxSpread_USDCAD    =         10.0;

extern string    Trade_EUR_JPY       = "=== Do you want to trade EURJPY? ===";
extern bool      EUR_JPY             =         true;
extern double    HighLevel_EURJPY    =          7.0;  // Level to reach for 1st condition become true
extern double    LowLevel_EURJPY     =          2.0;  // Level to not exceed for 2nd condition become true
extern double    TakeProfit_EURJPY   =         10.0;  // Profit for the order opened
extern double    StopLoss_EURJPY     =         10.0;  // StopLoss
extern int       MaxSpread_EURJPY    =         10.0;

extern string    Trade_EUR_GBP       = "=== Do you want to trade EURGBP? ===";
extern bool      EUR_GBP             =         true;
extern double    HighLevel_EURGBP    =          7.0;  // Level to reach for 1st condition become true
extern double    LowLevel_EURGBP     =          2.0;  // Level to not exceed for 2nd condition become true
extern double    TakeProfit_EURGBP   =         10.0;  // Profit for the order opened
extern double    StopLoss_EURGBP     =         10.0;  // StopLoss
extern int       MaxSpread_EURGBP    =         10.0;

extern string    Trade_EUR_CHF       = "=== Do you want to trade EURCHF? ===";
extern bool      EUR_CHF             =         true;
extern double    HighLevel_EURCHF    =          7.0;  // Level to reach for 1st condition become true
extern double    LowLevel_EURCHF     =          2.0;  // Level to not exceed for 2nd condition become true
extern double    TakeProfit_EURCHF   =         10.0;  // Profit for the order opened
extern double    StopLoss_EURCHF     =         10.0;  // StopLoss
extern int       MaxSpread_EURCHF    =         10.0;

extern string    Trade_EUR_AUD       = "=== Do you want to trade EURAUD? ===";
extern bool      EUR_AUD             =         true;
extern double    HighLevel_EURAUD    =          7.0;  // Level to reach for 1st condition become true
extern double    LowLevel_EURAUD     =          2.0;  // Level to not exceed for 2nd condition become true
extern double    TakeProfit_EURAUD   =         10.0;  // Profit for the order opened
extern double    StopLoss_EURAUD     =         10.0;  // StopLoss
extern int       MaxSpread_EURAUD    =         10.0;

extern string    Trade_GBP_JPY       = "=== Do you want to trade GBPJPY? ===";
extern bool      GBP_JPY             =         true;
extern double    HighLevel_GBPJPY    =          7.0;  // Level to reach for 1st condition become true
extern double    LowLevel_GBPJPY     =          2.0;  // Level to not exceed for 2nd condition become true
extern double    TakeProfit_GBPJPY   =         10.0;  // Profit for the order opened
extern double    StopLoss_GBPJPY     =         10.0;  // StopLoss
extern int       MaxSpread_GBPJPY    =         10.0;

extern string    Trade_GBP_CHF       = "=== Do you want to trade GBPCHF? ===";
extern bool      GBP_CHF             =         true;
extern double    HighLevel_GBPCHF    =          7.0;  // Level to reach for 1st condition become true
extern double    LowLevel_GBPCHF     =          2.0;  // Level to not exceed for 2nd condition become true
extern double    TakeProfit_GBPCHF   =         10.0;  // Profit for the order opened
extern double    StopLoss_GBPCHF     =         10.0;  // StopLoss
extern int       MaxSpread_GBPCHF    =         10.0;

#define ARRSIZE  12                     // number of pairs !!!DON'T CHANGE THIS NUMBER!!!
#define PAIRSIZE 7                      // number of currencies !!!DON'T CHANGE THIS NUMBER!!!
#define TABSIZE  10                     // scale of currency's power !!!DON'T CHANGE THIS NUMBER!!!
#define ORDER    2                      // available type of order !!!DON'T CHANGE THIS NUMBER!!!

#define EURUSD 0
#define GBPUSD 1
#define AUDUSD 2
#define USDJPY 3
#define USDCHF 4
#define USDCAD 5
#define EURJPY 6
#define EURGBP 7
#define EURCHF 8
#define EURAUD 9
#define GBPJPY 10
#define GBPCHF 11

#define USD 0
#define EUR 1
#define GBP 2
#define CHF 3
#define CAD 4
#define AUD 5
#define JPY 6

string aPair[ARRSIZE]   = {"EURUSDm","GBPUSDm","AUDUSDm","USDJPYm","USDCHFm","USDCADm",
                           "EURJPYm","EURGBPm","EURCHFm","EURAUDm","GBPJPYm","GBPCHFm"};
string aMajor[PAIRSIZE] = {"USD","EUR","GBP","CHF","CAD","AUD","JPY"};
string aOrder[ORDER]    = {"BUY ","SELL "};

double aMeter[PAIRSIZE];
double aHigh[ARRSIZE];
double aLow[ARRSIZE];
double aBid[ARRSIZE];
double aAsk[ARRSIZE];
double aRatio[ARRSIZE];
double aRange[ARRSIZE];
double aLookup[ARRSIZE];
double aStrength[ARRSIZE];
double point;
int    index;
string mySymbol;

double   sl, tp, lot;
int      cnt, ticket, total;
int      MagicAUDCAD, MagicAUDJPY, MagicAUDNZD, MagicAUDUSD, MagicCHFJPY, MagicEURAUD, MagicEURCAD;
int      MagicEURCHF, MagicEURGBP, MagicEURJPY, MagicEURUSD, MagicGBPCHF, MagicGBPJPY, MagicGBPUSD;
int      MagicNZDJPY, MagicNZDUSD, MagicUSDCHF, MagicUSDJPY, MagicUSDCAD;
bool firstStart = true;         

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

int deinit()
  {
   ObjectsDeleteAll(0,OBJ_LABEL);
   return(0);
  }

int start()

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

   for (index = 0; index < ARRSIZE; index++)    // initialize all pairs required value 
      {
      RefreshRates();   // refresh all currency's
      if (AccountIsIBFXmini) mySymbol = aPair[index];
      else mySymbol = StringSubstr(aPair[index],0,6);

      if (mySymbol == "USDJPY" || mySymbol == "EURJPY" || mySymbol == "GBPJPY") { point = 0.01; }
      else { point = 0.0001; }

      int aTable[TABSIZE]  = {0,3,10,25,40,50,60,75,90,97};
      if      (aRatio[index]*100 <= aTable[0]) aLookup[index]   = 0;
      else if (aRatio[index]*100 < aTable[1])  aLookup[index]   = 0;
      else if (aRatio[index]*100 < aTable[2])  aLookup[index]   = 1;
      else if (aRatio[index]*100 < aTable[3])  aLookup[index]   = 2;
      else if (aRatio[index]*100 < aTable[4])  aLookup[index]   = 3;
      else if (aRatio[index]*100 < aTable[5])  aLookup[index]   = 4;
      else if (aRatio[index]*100 < aTable[6])  aLookup[index]   = 5;
      else if (aRatio[index]*100 < aTable[7])  aLookup[index]   = 6;
      else if (aRatio[index]*100 < aTable[8])  aLookup[index]   = 7;
      else if (aRatio[index]*100 < aTable[9])  aLookup[index]   = 8;
      else                                     aLookup[index]   = 9;

      aHigh[index]     = MarketInfo(mySymbol,MODE_HIGH);                    // set a high today
      aLow[index]      = MarketInfo(mySymbol,MODE_LOW);                     // set a low today
      aBid[index]      = MarketInfo(mySymbol,MODE_BID);                     // set a last bid
      aAsk[index]      = MarketInfo(mySymbol,MODE_ASK);                     // set a last ask
      aRange[index]    = MathMax((aHigh[index]-aLow[index])/point,1);       // calculate range today
      aRatio[index]    = (aBid[index]-aLow[index])/aRange[index]/point;     // calculate pair ratio
      aStrength[index] = 9-aLookup[index];                                  // set a pair strengh
      }   //---- for

   aMeter[USD] = NormalizeDouble((aLookup[USDJPY]+aLookup[USDCHF]+aLookup[USDCAD]+aStrength[EURUSD]+aStrength[GBPUSD]+aStrength[AUDUSD])/6,1);
   aMeter[EUR] = NormalizeDouble((aLookup[EURUSD]+aLookup[EURJPY]+aLookup[EURGBP]+aLookup[EURCHF]+aLookup[EURAUD])/5,1);
   aMeter[GBP] = NormalizeDouble((aLookup[GBPUSD]+aLookup[GBPJPY]+aLookup[GBPCHF]+aStrength[EURGBP])/4,1);
   aMeter[CHF] = NormalizeDouble((aStrength[USDCHF]+aStrength[EURCHF]+aStrength[GBPCHF])/3,1);
   aMeter[CAD] = NormalizeDouble((aStrength[USDCAD]),1);
   aMeter[AUD] = NormalizeDouble((aLookup[AUDUSD]+aStrength[EURAUD])/2,1);
   aMeter[JPY] = NormalizeDouble((aStrength[USDJPY]+aStrength[EURJPY]+aStrength[GBPJPY])/3,1);

   objectBlank();   
   paintUSD(aMeter[USD]);
   paintEUR(aMeter[EUR]);
   paintGBP(aMeter[GBP]);
   paintCHF(aMeter[CHF]);
   paintCAD(aMeter[CAD]);
   paintAUD(aMeter[AUD]);
   paintJPY(aMeter[JPY]);
   paintLine();

    if ( ManagedLotSize )
    {
     lot = (( AccountBalance() * Risk ) / 1000) / PairsToTrade;
     if ( lot > MaxLot ) { lot = MaxLot; }
    }
    else { lot = Lot; }

   double eur = aMeter[EUR];
   double usd = aMeter[USD];
   double gbp = aMeter[GBP];
   double chf = aMeter[CHF];
   double cad = aMeter[CAD];
   double aud = aMeter[AUD];
   double jpy = aMeter[JPY]; 

   if ( AccountIsIBFXmini == true )
   {
    if ( EUR_USD == true && eur >= HighLevel_EURUSD && usd <= LowLevel_EURUSD && eur > 0 && usd > 0) { ManageBuy("EURUSDm",lot,TakeProfit_EURUSD,StopLoss_EURUSD,Slippage,MaxSpread_EURUSD,426811,"!xMeter EURvsUSD"); }
    if ( EUR_USD == true && usd >= HighLevel_EURUSD && eur <= LowLevel_EURUSD && eur > 0 && usd > 0) { ManageSell("EURUSDm",lot,TakeProfit_EURUSD,StopLoss_EURUSD,Slippage,MaxSpread_EURUSD,426811,"!xMeter EURvsUSD"); }

    if ( GBP_USD == true && gbp >= HighLevel_GBPUSD && usd <= LowLevel_GBPUSD && gbp > 0 && usd > 0) { ManageBuy("GBPUSDm",lot,TakeProfit_GBPUSD,StopLoss_GBPUSD,Slippage,MaxSpread_GBPUSD,426814,"!xMeter GBPvsUSD"); }
    if ( GBP_USD == true && usd >= HighLevel_GBPUSD && gbp <= LowLevel_GBPUSD && gbp > 0 && usd > 0) { ManageSell("GBPUSDm",lot,TakeProfit_GBPUSD,StopLoss_GBPUSD,Slippage,MaxSpread_GBPUSD,426814,"!xMeter GBPvsUSD"); }

    if ( AUD_USD == true && aud >= HighLevel_AUDUSD && usd <= LowLevel_AUDUSD && aud > 0 && usd > 0) { ManageBuy("AUDUSDm",lot,TakeProfit_AUDUSD,StopLoss_AUDUSD,Slippage,MaxSpread_AUDUSD,426804,"!xMeter AUDvsUSD"); }
    if ( AUD_USD == true && usd >= HighLevel_AUDUSD && aud <= LowLevel_AUDUSD && aud > 0 && usd > 0) { ManageSell("AUDUSDm",lot,TakeProfit_AUDUSD,StopLoss_AUDUSD,Slippage,MaxSpread_AUDUSD,426804,"!xMeter AUDvsUSD"); }

    if ( USD_JPY == true && usd >= HighLevel_USDJPY && jpy <= LowLevel_USDJPY && usd > 0 && jpy > 0) { ManageBuy("USDJPYm",lot,TakeProfit_USDJPY,StopLoss_USDJPY,Slippage,MaxSpread_USDJPY,426818,"!xMeter USDvsJPY"); }
    if ( USD_JPY == true && jpy >= HighLevel_USDJPY && usd <= LowLevel_USDJPY && usd > 0 && jpy > 0) { ManageSell("USDJPYm",lot,TakeProfit_USDJPY,StopLoss_USDJPY,Slippage,MaxSpread_USDJPY,426818,"!xMeter USDvsJPY"); }

    if ( USD_CHF == true && usd >= HighLevel_USDCHF && chf <= LowLevel_USDCHF && usd > 0 && chf > 0) { ManageBuy("USDCHFm",lot,TakeProfit_USDCHF,StopLoss_USDCHF,Slippage,MaxSpread_USDCHF,426817,"!xMeter USDvsCHF"); }
    if ( USD_CHF == true && chf >= HighLevel_USDCHF && usd <= LowLevel_USDCHF && usd > 0 && chf > 0) { ManageSell("USDCHFm",lot,TakeProfit_USDCHF,StopLoss_USDCHF,Slippage,MaxSpread_USDCHF,426817,"!xMeter USDvsCHF"); }

    if ( USD_CAD == true && usd >= HighLevel_USDCAD && cad <= LowLevel_USDCAD && usd > 0 && cad > 0) { ManageBuy("USDCADm",lot,TakeProfit_USDCAD,StopLoss_USDCAD,Slippage,MaxSpread_USDCAD,426819,"!xMeter USDvsCAD"); }
    if ( USD_CAD == true && cad >= HighLevel_USDCAD && usd <= LowLevel_USDCAD && usd > 0 && cad > 0) { ManageSell("USDCADm",lot,TakeProfit_USDCAD,StopLoss_USDCAD,Slippage,MaxSpread_USDCAD,426819,"!xMeter USDvsCAD"); }

    if ( EUR_JPY == true && eur >= HighLevel_EURJPY && jpy <= LowLevel_EURJPY && eur > 0 && jpy > 0) { ManageBuy("EURJPYm",lot,TakeProfit_EURJPY,StopLoss_EURJPY,Slippage,MaxSpread_EURJPY,426810,"!xMeter EURvsJPY"); }
    if ( EUR_JPY == true && jpy >= HighLevel_EURJPY && eur <= LowLevel_EURJPY && eur > 0 && jpy > 0) { ManageSell("EURJPYm",lot,TakeProfit_EURJPY,StopLoss_EURJPY,Slippage,MaxSpread_EURJPY,426810,"!xMeter EURvsJPY"); }

    if ( EUR_GBP == true && eur >= HighLevel_EURGBP && gbp <= LowLevel_EURGBP && eur > 0 && gbp > 0) { ManageBuy("EURGBPm",lot,TakeProfit_EURGBP,StopLoss_EURGBP,Slippage,MaxSpread_EURGBP,426809,"!xMeter EURvsGBP"); }
    if ( EUR_GBP == true && gbp >= HighLevel_EURGBP && eur <= LowLevel_EURGBP && eur > 0 && gbp > 0) { ManageSell("EURGBPm",lot,TakeProfit_EURGBP,StopLoss_EURGBP,Slippage,MaxSpread_EURGBP,426809,"!xMeter EURvsGBP"); }

    if ( EUR_CHF == true && eur >= HighLevel_EURCHF && chf <= LowLevel_EURCHF && eur > 0 && chf > 0) { Ma

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

Как получить полную версию?

Введите ваш email и нажмите кнопку, чтобы перейти к оплате.