请教ChartSetSymbolPeriod切换货币对后,ma值都没变化
因为不想在每个货币对挂EA,就想在一个图表间隔切换货币对
ChartSetSymbolPeriod切换成功了,但是求出的移动平均值还是上一个货币对的均值
请问有没有人知道,问题大概出现在哪里?
//+------------------------------------------------------------------+
//| myea.mq4 |
//| Copyright 2016, MetaQuotes Software Corp. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2016, MetaQuotes Software Corp."
#property link "https://www.mql5.com"
#property version "1.00"
#property strict
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//---
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//---
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
double ma13 = iMA(NULL,0,13,0,MODE_SMA,PRICE_CLOSE,0);
double ma5 = iMA(NULL,0,5,0,MODE_SMA,PRICE_CLOSE,0);
string money[30] = {"EURUSD","USDJPY","EURJPY","AUDUSD","AUDJPY","CADJPY","CHFJPY","EURAUD","EURGBP","GBPJPY"};
void OnTick()
{
if(Minute()%30 == 0){
checkMoney(0);
}else if(Minute()%30 == 1){
checkMoney(1);
}else if(Minute()%30 == 2){
checkMoney(2);
}else if(Minute()%30 == 3){
checkMoney(3);
}else if(Minute()%30 == 4){
checkMoney(4);
}else if(Minute()%30 == 5){
checkMoney(5);
}else if(Minute()%30 == 6){
checkMoney(6);
}else if(Minute()%30 == 7){
checkMoney(7);
}else if(Minute()%30 == 8){
checkMoney(8);
}else if(Minute()%30 == 9){
checkMoney(9);
}
}
//+------------------------------------------------------------------+
void checkMoney(int i){
if(Symbol() != money[i]){
if(ChartSetSymbolPeriod(0,money[i],0)){
}else{
Alert(money[i]+"打开失败");
}
}
Alert(ma5+","+ma13);
}
|
|
|
|
|