小男孩‘自慰网亚洲一区二区,亚洲一级在线播放毛片,亚洲中文字幕av每天更新,黄aⅴ永久免费无码,91成人午夜在线精品,色网站免费在线观看,亚洲欧洲wwwww在线观看

分享

新增功能——通過(guò)文件讀寫(xiě)函數(shù)實(shí)現(xiàn)跨周期數(shù)據(jù)調(diào)用

 禁忌石 2011-08-15
新增功能——通過(guò)文件讀寫(xiě)函數(shù)實(shí)現(xiàn)跨周期數(shù)據(jù)調(diào)用
TB3.2.2增加了文件讀寫(xiě)功能函數(shù),SetTBProfileString和GetTBProfileString,
通過(guò)使用這兩個(gè)函數(shù),可以實(shí)現(xiàn)較復(fù)雜的應(yīng)用,比如跨周期數(shù)據(jù)調(diào)用。
SetTBProfileString將數(shù)據(jù)內(nèi)容寫(xiě)到用戶(hù)公式目錄tblprofile.ini文件下。


下文以5分鐘周期調(diào)用日線(xiàn)指標(biāo)數(shù)據(jù)舉例講解具體應(yīng)用。

操作步驟如下:
1、新建一個(gè)工作區(qū),包含上下兩個(gè)圖表窗體,上面選擇日線(xiàn)周期,下面選擇5分鐘周期。
2、新建一個(gè)技術(shù)指標(biāo),命名為MyDayMA。編譯成功后插入日線(xiàn)圖表中。詳細(xì)代碼如下:


Params
Numeric length(10);
Vars
Numeric MA;
string strkey;
string strValue;
Begin
MA = AverageFC(Close,length);
strKey = DateToString(Date);
strValue = Text(MA);
SetTBProfileString("DayMA",strKey,strValue);
PlotNumeric("MA",MA);
End

3、新建一個(gè)技術(shù)指標(biāo),My5MinMA。編譯成功后插入5分鐘圖表中,詳細(xì)代碼如下:


Vars
NumericSeries DayMAValue;
string strKey;
string strValue;
Begin
strKey = DateToString(Date);
strValue = GetTBProfileString("DayMA",strKey);
If(strValue != InvalidString)
{
DayMAValue = Value(strValue);
}Else
{
DayMAValue = DayMAValue[1];
}
PlotNumeric("DayMA",DayMAValue);
End

4、上面的指標(biāo)實(shí)際使用了未來(lái)數(shù)據(jù),用來(lái)寫(xiě)指標(biāo)是可以的,但用來(lái)做交易指令進(jìn)行自動(dòng)交易就會(huì)出問(wèn)題,為了更準(zhǔn)確合理的使用跨周期數(shù)據(jù),我們應(yīng)該稍作修改,代碼如下:


Vars
NumericSeries DayMAValue;
StringSeries strKey;
string strValue;
Begin
If(Date!=Date[1])
{
strKey = DateToString(Date[1]);
}Else
{
strKey = strKey[1];
}

strValue = GetTBProfileString("DayMA",strKey);
If(strValue != InvalidString)
{
DayMAValue = Value(strValue);
}Else
{
DayMAValue = DayMAValue[1];
}
PlotNumeric("DayMA",DayMAValue);
End

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶(hù)發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買(mǎi)等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶(hù) 評(píng)論公約

    類(lèi)似文章 更多