close
MA1[i] = iMA(NULL, 0, 5, 0, 1, PRICE_CLOSE, i);
MA2[i] = iMA(NULL, 0, 10, 0, 1, PRICE_CLOSE, i);
MA3[i] = (MA1[i]+MA2[i])/2;
如果這樣寫, MA3裡包含了MA1[]&MA2[]兩個Array
編程不會顯示錯誤, 但是MA3會跑不出來;
改成下面的寫法就可以了
double mm =iMA(NULL, 0, 5, 0, 1, PRICE_CLOSE, i);
double kk =iMA(NULL, 0, 10, 0, 1, PRICE_CLOSE, i);
MA1[i] = mm;
MA2[i] = kk;
MA3[i] = (mm + kk)/2;
或是
MA1[i] = iMA(NULL, 0, 5, 0, 1, PRICE_CLOSE, i);
MA2[i] = iMA(NULL, 0, 10, 0, 1, PRICE_CLOSE, i);
MA3[i] = (iMA(NULL, 0, 5, 0, 1, PRICE_CLOSE, i)+ iMA(NULL, 0, 10, 0, 1, PRICE_CLOSE, i))/2;
全站熱搜
留言列表