幫手您好:
我寫了一個自定義的指標,用個股K線,調成5分K,但只能拉到2兩個禮拜前,再往前指標就顯示NULL了,
請問該如何改善?謝謝
code如下:
函數:
input:thePrice(numericseries); //"價格序列"
input:Length(Numeric); //"計算期間"
input:multiP(numericsimple); //權重
variable: Factor(0);
if length + 1 = 0 and multiP=2 then Factor = 1 else if multiP=2 then Factor = 2 / (Length + 1);
if length + 1 = 0 and multiP=1 then Factor = 1 else if multiP=1 then Factor = 1 / (Length+5);
if CurrentBar = 1 then
EMA_m = thePrice
else if CurrentBar <= Length then
EMA_m = (thePrice + (EMA_m[1]*(CurrentBar-1)))/CurrentBar
else
EMA_m = EMA_m[1] + Factor * (thePrice - EMA_m[1]);
指標設定:
Input: Period1(23); SetInputName(1, "EMA1");
input: mult(1,"權重(1,2)");
Plot1(EMA_M(Close, Period1, mult), "EMA1");
setplotlabel(1,"EMA"+numtostr(Period1,0));
Question2:
5分鐘即時有勾選逐筆洗價 => 每根Tick運算一次,以5分鐘頻率的資訊作判斷。
每根Tick是什麼一次?,只要有人成交就算嗎?,還是有範圍時間呢
1分鐘即時有勾選逐筆洗價跟5分鐘即時有勾選逐筆洗價 除了頻率K外 其它有差嗎?
Question3:
如果以5分K、20MA為基準,在20ma 「上」 為一次計算 「下」為一次計算 , 「上」 為一次計算 「下」為一次計算
能計算範圍時間內在20MA以上下的K棒的平均高點(上、下)(每一個波的最高碰到轉下又算一個波)嗎?

2 評論