거래 로봇을 무료로 다운로드 하는 법을 시청해보세요
당사를 Twitter에서 찾아주십시오!
당사 팬 페이지에 가입하십시오
스크립트가 흥미로우신가요?
그렇다면 링크 to it -
하셔서 다른 이들이 평가할 수 있도록 해보세요
스크립트가 마음에 드시나요? MetaTrader 5 터미널에서 시도해보십시오
Experts

Example of Heiken Ashi Using Multi Time Frame (MTF) - MetaTrader 4용 expert

Mohammad Soubra
게시자:
Mohammed Abdulwadud Soubra
조회수:
26255
평가:
(16)
게시됨:
2017.04.11 09:21
이 코드를 기반으로 한 로봇이나 지표가 필요하신가요? 프리랜스로 주문하세요 프리랜스로 이동

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.