|
本帖最後由 tapehero 於 12-3-4 02:21 PM 編輯
語法問題請教版上先進:
小弟寫了下面的程式想要算出pivot點當天5/10/30日均值:
當程式碼寫成下面時,算出來的pivotH3FastMA/pivotH3MidMA/pivotH3SlowMA都是不對的(算出來的值都是最後一根k的)
Inputs: Price(Low),
LeftStrength3(4), RightStrength3(2),
FastLength(5), MidLength(10), SlowLength(30);
pivotH3V = PivotHighVS(1, High, LeftStrength3, RightStrength3, RightStrength3+1);
pivotH3Bar = PivotHighVSBar(1, High, LeftStrength3, RightStrength3, RightStrength3+1);
if pivotH3Bar >= 1 then begin
pivotH3FastMA = AverageFC(Close, FastLength)[pivotH3Bar];
pivotH3MidMA = AverageFC(Close, MidLength)[pivotH3Bar];
pivotH3SlowMA = AverageFC(Close, SlowLength)[pivotH3Bar];
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
但如果把其中的FastLength, MidLength, SlowLength改成數字就正確了,請問這是什麼問題呢?
另外想請問: 函數是否不能引用變數呢? 謝謝指教~
pivotH3V = PivotHighVS(1, High, LeftStrength3, RightStrength3, RightStrength3+1);
pivotH3Bar = PivotHighVSBar(1, High, LeftStrength3, RightStrength3, RightStrength3+1);
if pivotH3Bar >= 1 then begin
pivotH3FastMA = AverageFC(Close, 05)[pivotH3Bar];
pivotH3MidMA = AverageFC(Close, 10)[pivotH3Bar];
pivotH3SlowMA = AverageFC(Close, 30)[pivotH3Bar];
|
|