Interesting script?
So post a link to it -
let others appraise it

You liked the script? Try it in the MetaTrader 5 terminal

2017.04.11 09:21

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

Views:
2971
Rating:

### 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:

if(AshiUp(1440)==1 && AshiUp()==1)

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() == "Platinum"  || Symbol() == "PLATINUM"  || Symbol() == "platinum"  || Symbol() == "PTCMDUSD" )
{
Comment(SymbolErr);
return(INIT_FAILED);
}
.
.
.
}

### 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).

LRDegrees MT4

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

Auto Fibo

Automatic Fibonacci with ZigZag Base.