指定范圍內(nèi)數(shù)據(jù)求和
作者:開拓者 TB 來源:cxh99.com 發(fā)布時間:2016年06月07日
- 咨詢內(nèi)容:
假如說當前共計有2000根K線,我只需要對1000到1050這個范圍內(nèi)的收盤價求和,我該怎么做,麻煩幫我看下如何編寫對應代碼
- TB技術(shù)人員:
Params
Numeric NumBegin(10);
Numeric NumAdd(5);
Vars
NumericSeries GetNum(0);
Numeric Total(0);
Begin
GetNum=close;
If(currentbar>=NumBegin and currentbar<NumBegin+NumAdd)
PlotString("Num",text(GetNum),h);
If(barstatus==0 or currentbar>NumBegin+NumAdd)
{SetGlobalVar(1,InvalidNumeric)lotBool("c",true);}
If(currentbar==NumBegin) SetGlobalVar(1,close);
If(currentbar>=NumBegin+1 And CurrentBar<NumBegin+NumAdd)
{
Total=GetNum+GetGlobalVar(1);
SetGlobalVar(1,Total);
PlotString("total",text(getglobalvar(1)),low,-1,0);}
End
希望能滿足你的要求,格式寫的有點亂
- TB客服:
樓上大才。。。
Summation(c[1000],50);