Mira cómo descargar robots gratis
¡Búscanos en Telegram!
Pon "Me gusta" y sigue las noticias
¿Es interesante este script?
Deje un enlace a él, ¡qué los demás también lo valoren!
¿Le ha gustado el script?
Evalúe su trabajo en el terminal MetaTrader 5
Asesores Expertos

Example of Heiken Ashi Using Multi Time Frame (MTF) - Asesor Experto para MetaTrader 4

Mohammad Soubra
Publicado por:
Mohammed Abdulwadud Soubra
Visualizaciones:
26225
Ranking:
(16)
Publicado:
2017.04.11 09:21
HeikenAshiIdea.mq4 (29.79 KB) ver
¿Necesita un robot o indicador basado en este código? Solicítelo en la bolsa freelance Pasar a la bolsa

Description

This is an example for Heiken Ashi candles.

  • Only uses pending orders (Buy-Limit & Sell-Limit).
  • Hedging is possible (by using different magic numbers).
  • Filter is possible (by two time frames as the code below).

see the main idea of this expert in these following two functions:

int AshiUp(int TF=PERIOD_CURRENT)
  {
   double haLowHigh_1 = iCustom(Symbol(),TF,"Heiken Ashi",Red,White,Red,White,0,1);
   double haOpen_1    = iCustom(Symbol(),TF,"Heiken Ashi",Red,White,Red,White,2,1);
   double haClose_1   = iCustom(Symbol(),TF,"Heiken Ashi",Red,White,Red,White,3,1);

   double haLowHigh_0 = iCustom(Symbol(),TF,"Heiken Ashi",Red,White,Red,White,0,0);
   double haOpen_0    = iCustom(Symbol(),TF,"Heiken Ashi",Red,White,Red,White,2,0);
   double haClose_0   = iCustom(Symbol(),TF,"Heiken Ashi",Red,White,Red,White,3,0);

   if((haClose_0>haOpen_0 && haOpen_0==haLowHigh_0) && 
      (haClose_1>haOpen_1 && haOpen_1!=haLowHigh_1))
      return(1);

   else  return(0);
  }


int AshiDown(int TF=PERIOD_CURRENT)
  {
   double haLowHigh_1 = iCustom(Symbol(),TF,"Heiken Ashi",Red,White,Red,White,0,1);
   double haOpen_1    = iCustom(Symbol(),TF,"Heiken Ashi",Red,White,Red,White,2,1);
   double haClose_1   = iCustom(Symbol(),TF,"Heiken Ashi",Red,White,Red,White,3,1);

   double haLowHigh_0 = iCustom(Symbol(),TF,"Heiken Ashi",Red,White,Red,White,0,0);
   double haOpen_0    = iCustom(Symbol(),TF,"Heiken Ashi",Red,White,Red,White,2,0);
   double haClose_0   = iCustom(Symbol(),TF,"Heiken Ashi",Red,White,Red,White,3,0);

   if((haClose_0<haOpen_0 && haOpen_0==haLowHigh_0) && 
      (haClose_1<haOpen_1 && haOpen_1!=haLowHigh_1))
      return(1);

   else  return(0);
  }

see the code below for detect buy:

//--- Trading
   if(TotalOrdersCount(MagicNumberBuy)<1)
      if(AshiUp(1440)==1 && AshiUp()==1)
         BuyExecute();

In addition, it is not allowed to work with metals as you can see below:

//+------------------------------------------------------------------+
//| Expert initialization function
//+------------------------------------------------------------------+
int OnInit()
  {
   Comment(" ");

   if(Symbol()=="Gold" || Symbol()=="GOLD" || Symbol()=="gold" || Symbol()=="XAUUSD" || Symbol()=="AUCMDUSD"
      || Symbol() == "Silver" || Symbol() == "SILVER" || Symbol() == "silver" || Symbol() == "XAGUSD" || Symbol() == "E_SI"
      || Symbol() == "Copper" || Symbol() == "COPPER" || Symbol() == "copper" || Symbol() == "CUCMDUSD"
      || Symbol() == "XAUEUR" || Symbol() == "Gold.Euro"    || Symbol() == "Gold.Eur"
      || Symbol() == "XAGEUR" || Symbol() == "Silver.Euro"  || Symbol() == "Silver.Eur"
      || Symbol() == "USOil"  || Symbol() == "USOIL"  || Symbol() == "UKOil"  || Symbol() == "UKOIL"
      || Symbol() == "NGAS"   || Symbol() == "NGas"   || Symbol() == "Bund"   || Symbol() == "BUND"   || Symbol() == "bund"
      || Symbol() == "Oil" || Symbol() == "Brent" || Symbol() == "BRENT" || Symbol() == "brent"       || Symbol() == "Crude"  || Symbol() == "COPPER" || Symbol() == "BRENTCMDUSD"
      || Symbol() == "WTI" || Symbol() == "Light" || Symbol() == "LIGHT" || Symbol() == "LIGHTCMDUSD" || Symbol() == "COPPER"
      || Symbol() == "Palladium" || Symbol() == "PALLADIUM" || Symbol() == "palladium" || Symbol() == "PDCMDUSD"
      || Symbol() == "Platinum"  || Symbol() == "PLATINUM"  || Symbol() == "platinum"  || Symbol() == "PTCMDUSD" )
     {
      Comment(SymbolErr);
      Alert(SymbolErr);
      return(INIT_FAILED);
     }
.
.
.
}

Image

Example of Heiken Ashi Using Multi Time Frame (MTF)

Recommendations

  • This example code is only for coders/traders who are interested for free codes in order to learn/modify it in the future.
  • Don't use it on real money trading.
  • Use it only in Demo or Strategy Tester.
  • You can remove lines (from 55 to 70) in order to try it in metals.

Good Luck.

RSI Accumulated (Floating Levels) RSI Accumulated (Floating Levels)

Accumulated RSI that uses floating levels or quantile bands.

LRDegrees MT4 LRDegrees MT4

Forex indicator for MetaTrader 4 with show double line of linear regression with position degrees and trend alerts.

Auto Fibo Auto Fibo

Automatic Fibonacci with ZigZag Base.

Trade Multiplier Trade Multiplier

This expert will copy a trade with the preset volume on the same account, can be used with a signal. No cross-account functionality.