如何區(qū)別這幾個(gè)函數(shù) - TradeBlazer公式
作者:開拓者 TB 來(lái)源:cxh99.com 發(fā)布時(shí)間:2012年08月25日
- 咨詢內(nèi)容:
A_CurrentEquity: 返回當(dāng)前公式應(yīng)用的交易帳戶的動(dòng)態(tài)權(quán)益。[是動(dòng)態(tài)總資產(chǎn)?無(wú)論持倉(cāng)與否?]
A_FreeMargin: 返回當(dāng)前公式應(yīng)用的交易帳戶的可用資金。
A_ProfitLoss: 返回當(dāng)前公式應(yīng)用的交易帳戶的浮動(dòng)盈虧。
CurrentCapital: 獲得當(dāng)前的可用資金。
PositionProfit: 獲得當(dāng)前持倉(cāng)位置的浮動(dòng)盈虧。
A_CurrentEquity: 返回當(dāng)前公式應(yīng)用的交易帳戶的動(dòng)態(tài)權(quán)益=
A_FreeMargin: 返回當(dāng)前公式應(yīng)用的交易帳戶的可用資金+A_ProfitLoss: 返回當(dāng)前公式應(yīng)用的交易帳戶的浮動(dòng)盈虧?
CurrentCapital: 獲得當(dāng)前的可用資金 與 A_FreeMargin: 返回當(dāng)前公式應(yīng)用的交易帳戶的可用資金 一樣嗎?
謝謝
[ 本帖最后由 wgcpsxj 于 2007-7-28 22:27 編輯 ]
- TB技術(shù)人員:
原帖由 wgcpsxj 于 2007-7-28 22:11 發(fā)表 ![]()
A_CurrentEquity: 返回當(dāng)前公式應(yīng)用的交易帳戶的動(dòng)態(tài)權(quán)益。[是動(dòng)態(tài)總資產(chǎn)?無(wú)論持倉(cāng)與否?]
A_FreeMargin: 返回當(dāng)前公式應(yīng)用的交易帳戶的可用資金。
A_ProfitLoss: 返回當(dāng)前公式應(yīng)用的交易帳戶的浮動(dòng)盈虧。
CurrentCapit ...
A_XXXX函數(shù)是您設(shè)置自動(dòng)交易之后,真實(shí)帳戶的資金,盈虧情況。
不加A_的函數(shù)是模擬測(cè)試過(guò)程中您的模擬賬戶的情況。
一般在不是最后一個(gè)Bar,我們都采取CurrentCapital這樣的函數(shù)來(lái)進(jìn)行測(cè)試的計(jì)算或交易。
在最后一個(gè)Bar,因?yàn)闀?huì)真實(shí)交易,需要根據(jù)真實(shí)交易的情況來(lái)資金判斷或下單。
下面是一個(gè)簡(jiǎn)單的例子,根據(jù)可用資金的20%來(lái)開倉(cāng)。
- Vars
- Numeric entryLots; // 開倉(cāng)數(shù)量
- Begin
- ....
- If(BarStatus== 2) // 當(dāng)前Bar為最后一個(gè)Bar
- {
- entryLots = (A_FreeMargin * 0.2) /(Q_AskPrice*ContractUnit*MarginRatio);
- entryLots = IntPart(entryLots ); // 取整
- Buy(entryLots,Q_AskPrice); // 用現(xiàn)在的叫賣價(jià)買入
- }Else
- {
- entryLots= (CurrentCapital * 0.2)/(Close*ContractUnit*MarginRatio);
- entryLots = IntPart(entryLots ); // 取整
- Buy(entryLots,Close); // 用現(xiàn)在的叫賣價(jià)買入
- }
- .......
- End
復(fù)制代碼
- TB客服:
學(xué)習(xí)了
- 網(wǎng)友回復(fù):
不是不讓buy和Q-函數(shù)連用么?