開(kāi)拓者 TB用matlab測(cè)試出來(lái)一個(gè)比較不錯(cuò)的交易系統(tǒng) [開(kāi)拓者 TB]
用matlab測(cè)試出來(lái)一個(gè)比較不錯(cuò)的交易系統(tǒng),用TB實(shí)現(xiàn)的時(shí)候,卡在這里了,急求幫助啊!
代碼如下
Params
Numeric my_Entryprice(0);
Numeric bar_keep(1);
Numeric profits_lost_ratio(0.01);
Vars
Numeric high_price;
Numeric low_price;
Numeric i;
Numeric profits_lost_state(0);
Begin
high_price=high[bar_keep];
low_price=low[bar_keep];
for i= bar_keep DownTo 1
{
If(close[i] > high_price)
high_price =close[i];
if(close[i] < low_price)
low_price =close[i];
}
if (MarketPosition==1)
{ If high_price-my_Entryprice>=profits_lost_ratio*OpenD(0) // 達(dá)到止盈條件
{ if (-close[1]+high_price)>=(high_price-my_Entryprice)*0.5
{
profits_lost_state=1;
return;
}
}
if high_price-my_Entryprice>=profits_lost_ratio*OpenD(0)*2
{ if (-close[1]+high_price)>=(high_price-my_Entryprice)*0.3
{
profits_lost_state=1;
return;
}
}
if high_price-my_Entryprice>=profits_lost_ratio*OpenD(0)*3
{ if (-close[1]+high_price)>=(high_price-my_Entryprice)*0.1
{
profits_lost_state=1;
return;
}
}
if -close[1]+my_Entryprice>=profits_lost_ratio*OpenD(0) // 達(dá)到止損條件
{
profits_lost_state=-1;
return;
}
}
if (MarketPosition==-1)
{ if -low_price+my_Entryprice>=profits_lost_ratio*OpenD(0) // 達(dá)到止盈條件
{ if (close[1]-low_price)>=(-low_price+my_Entryprice)*0.5
{
profits_lost_state=1;
return;
}
}
if -low_price+my_Entryprice>=profits_lost_ratio*OpenD(0)*2
{ if (close[1]-low_price)>=(-low_price+my_Entryprice)*0.3
{
profits_lost_state=1;
return;
}
}
if -low_price+my_Entryprice>=profits_lost_ratio*OpenD(0)*3
{ if (close[1]-low_price)>=(-low_price+my_Entryprice)*0.1
{
profits_lost_state=1;
return;
}
}
if close[1]-my_Entryprice>=profits_lost_ratio*OpenD(0) // 達(dá)到止損條件
{
profits_lost_state=-1;
return;
}
}
}
Return profits_lost_state;
End
編譯的時(shí)候:無(wú)法識(shí)別的是high_price- TB技術(shù)人員: 找到原因了,原來(lái)是編程習(xí)慣造成的
if 后面沒(méi)有括號(hào) - TB客服:
有思路,想編寫(xiě)各種指標(biāo)公式,程序化交易模型,選股公式,預(yù)警公式的朋友
可聯(lián)系技術(shù)人員 QQ: 262069696 進(jìn)行 有償 編寫(xiě)!(不貴!點(diǎn)擊查看價(jià)格!)
相關(guān)文章
-
沒(méi)有相關(guān)內(nèi)容