问题描述
所以它基本上有 3 条线,我希望多头交易的收盘价已经越过中线,但不是上线。我无法在我的 if 语句中使用它。
目前我确实让中间线向上交叉,但如果蜡烛越过上线,它也会显示买入信号,这是不好的。请帮忙...
我的 EA 代码:
// 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 );
double band_1 = iCustom(_Symbol,1,0 );
double band_2 = iCustom(_Symbol,2,0 );
double band_3 = iCustom(_Symbol,3,0 );
double band_up = iCustom(_Symbol,4,0 );
double band_down = iCustom(_Symbol,5,0 );
//strategy
double band_middle_curr = iCustom(_Symbol,0 );
double band_middle_prev = iCustom(_Symbol,1 );
double band_up_prev = iCustom(_Symbol,1 );
double band_up_curr = iCustom(_Symbol,0 );
Comment(band_up_prev);
if(Close[0] > band_middle_curr && Close[0] < band_up_curr)
{
Print("open a buy order");
}
}
//+------------------------------------------------------------------+
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)