Code:
// the input variables of the EA
input ENUM_TIMEFRAMES TimeFrame = PERIOD_CURRENT;
input int AMAPeriod = 10;
input ENUM_APPLIED_PRICE AMAPrice = PRICE_CLOSE;
input int Nfast = 2;
input int Nslow = 30;
input double GCoeff = 2;
input int PriceFilter = 5;
input maTypes PriceFilterMode = ma_smoo;
input bool Interpolate = true;
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//---
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//---
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
//---
double band_middle = iCustom(_Symbol,_Period,"kaufman_ama_averages_filtered_ATR bands",TimeFrame, AMAPeriod, AMAPrice,Nfast, Nslow, GCoeff, PriceFilter, PriceFilterMode,Interpolate, 0,0 );
double band_1 = iCustom(_Symbol,_Period,"kaufman_ama_averages_filtered_ATR bands",TimeFrame, AMAPeriod, AMAPrice,Nfast, Nslow, GCoeff, PriceFilter,PriceFilterMode,Interpolate, 1,0 );
double band_2 = iCustom(_Symbol,_Period,"kaufman_ama_averages_filtered_ATR bands",TimeFrame, AMAPeriod, AMAPrice,Nfast, Nslow, GCoeff, PriceFilter,PriceFilterMode,Interpolate, 2,0 );
double band_3 = iCustom(_Symbol,_Period,"kaufman_ama_averages_filtered_ATR bands",TimeFrame, AMAPeriod, AMAPrice,Nfast, Nslow, GCoeff, PriceFilter,PriceFilterMode, Interpolate, 3,0 );
double band_up = iCustom(_Symbol,_Period,"kaufman_ama_averages_filtered_ATR bands",TimeFrame, AMAPeriod, AMAPrice,Nfast, Nslow, GCoeff, PriceFilter,PriceFilterMode, Interpolate, 4,0 );
double band_down = iCustom(_Symbol,_Period,"kaufman_ama_averages_filtered_ATR bands",TimeFrame, AMAPeriod, AMAPrice,Nfast, Nslow, GCoeff, PriceFilter,PriceFilterMode, Interpolate, 5,0 );
//strategy
double band_middle_curr = iCustom(_Symbol,_Period,"kaufman_ama_averages_filtered_ATR bands",TimeFrame, AMAPeriod, AMAPrice,Nfast, Nslow, GCoeff, PriceFilter, PriceFilterMode,Interpolate, 0,0 );
double band_middle_prev = iCustom(_Symbol,_Period,"kaufman_ama_averages_filtered_ATR bands",TimeFrame, AMAPeriod, AMAPrice,Nfast, Nslow, GCoeff, PriceFilter, PriceFilterMode,Interpolate, 0,1 );
double band_up_prev = iCustom(_Symbol,_Period,"kaufman_ama_averages_filtered_ATR bands",TimeFrame, AMAPeriod, AMAPrice,Nfast, Nslow, GCoeff, PriceFilter,PriceFilterMode, Interpolate, 4,1 );
double band_up_curr = iCustom(_Symbol,_Period,"kaufman_ama_averages_filtered_ATR bands",TimeFrame, AMAPeriod, AMAPrice,Nfast, Nslow, GCoeff, PriceFilter,PriceFilterMode, Interpolate, 4,0 );
Comment(band_up_prev);
if(Close[0] > band_middle_curr && Close[0] < band_up_curr)
{
Print("open a buy order");
}
}
//+------------------------------------------------------------------+