关于代码转换 [文华财经]
-
咨询内容:
老师,麻烦请将下面的TB代码转换成文华,谢谢!
//------------------------------------------------------------------------
// 简称: PreBreakATR_TradingSystem
// 名称: PreBreakATR_TradingSystem
// 类别: 公式应用
// 类型: 用户应用
// 输出:
//------------------------------------------------------------------------
Params
Numeric lots(1);
Numeric PAR_1(2);
Numeric PAR_2(12);
Numeric PAR_3(4.25);
Numeric PAR_4(32);
Numeric PAR_5(2);
Numeric PAR_6(1);
Numeric PAR_7(86);
Numeric PAR_8(6);
Numeric PAR_9(930);
Numeric PAR_10(1400);
Vars
NumericSeries VAR_1;
Numeric VAR_2(0);
Numeric VAR_3;
Numeric VAR_4;
Numeric VAR_5;
Numeric VAR_6;
NumericSeries VAR_7;
NumericSeries VAR_8;
Numeric VAR_9;
Numeric VAR_10;
bool boll_1;
Numeric tmp;
Numeric tmp2;
bool boll_2;
bool boll_3;
bool boll_4;
Begin
VAR_1=AvgTrueRange(PAR_7);boll_1=Time>0.0001*PAR_9 And Time <PAR_10 * 0.0001;
if (BarsSinceEntry == 1)
{
VAR_7 = AvgEntryPrice;
VAR_8 = AvgEntryPrice;
}
Else If(BarsSinceEntry > 1)
{
VAR_7 = Max(VAR_7[1],High[1]);
VAR_8 = Min(VAR_8[1],Low[1]);
}
Else
{
VAR_7 = VAR_7[1];
VAR_8 = VAR_8[1];
}
VAR_6 = MinMove*PriceScale;VAR_3=Average(high[1]-low[1],PAR_1);
VAR_4=Average(open,PAR_2)+VAR_3*PAR_3;
VAR_5=Average(open,PAR_2)-VAR_3*PAR_3;
boll_4=boll_1 and MarketPosition<>-1 && Low<=VAR_5 ;
boll_3=boll_1 and MarketPosition<>1 && high>=VAR_4 ;
If(boll_4)
{
VAR_10 = VAR_5-VAR_2*VAR_6;
If(Open < VAR_5)
VAR_10 = Open-VAR_2*VAR_6;sellshort(lots,VAR_10);
Return;
}If(boll_3)
{
VAR_10 = VAR_4+VAR_2*VAR_6;
If(Open > VAR_4)
VAR_10 = Open+VAR_2*VAR_6;
Buy(lots,VAR_10);
Return;
}
If(MarketPosition==1 && BarsSinceEntry >0)
{
VAR_9 = EntryPrice * (1-PAR_4/1000);
If (VAR_7 >= EntryPrice * (1 + PAR_5/1000))
{
VAR_9 = VAR_7*(1-PAR_6/1000);
}
}
If(Low <= VAR_9)
{
VAR_10 = VAR_9;
If(Open < VAR_10) VAR_10 = Open;
Sell(Lots,VAR_10);
}
Else If(MarketPosition ==-1 && BarsSinceEntry >0)
{
VAR_9 = EntryPrice * (1+PAR_4/1000);
If(VAR_8 <= EntryPrice*(1-PAR_5/1000))
{
VAR_9 = VAR_8 * (1+PAR_6/1000);
}
}
If(High >= VAR_9)
{
VAR_10 = VAR_9;
If(Open > VAR_10) VAR_10 =Open;
BuyToCover(Lots,VAR_10);
}If(MarketPosition==1)
{
VAR_9 = VAR_7 - PAR_8*VAR_1[1];
}
If(Low <= VAR_9)
{
VAR_10 = VAR_9;
If(Open < VAR_10) VAR_10 = Open;
Sell(Lots,VAR_10);
}
Else If(MarketPosition ==-1)
{
VAR_9 = VAR_8 + PAR_8*VAR_1[1];
}
If(High >= VAR_9)
{
VAR_10 = VAR_9;
If(Open > VAR_10) VAR_10 =Open;
BuyToCover(Lots,VAR_10);
}End
来源:程序化99
-
文华技术人员:
老师,以上模型是我从朋友那里得来的,我也不知道这个思路,所以想请老师转成文华,我学习一下。如果实在麻烦,我适当付些钱也可以,您看是否可以?
来源: WWW.CXH99.COM
-
文华客服:
您的意思是以后TB模型直接可以在文华的WH9上运行?如果这样,太棒了
-
网友回复:
参考:
不同软件对函数的处理不同,加载效果不同是正常的
VARIABLE:B1:=0,B2:=0;HH:=IF(H>REF(C,1),H,REF(C,1));LL:=MIN(L,REF(C,1));VAR1:=MA((HH-LL),86);IF BARSSK>1 THENA2:=IF(SKHIGH>=SKPRICE*(1-2/1000),SKHIGH*(1-1/1000),SKPRICE*(1-32/1000));B1:=IF(L<A2,A2,IF(O<A2,O,NULL));IF BARSSK>0&&BARSSK<=1 THENB1:=IF(L<SKHIGH-SKLOW*REF(VAR1,1),SKHIGH-SKLOW*REF(VAR1,1),O);
IF BARSBK>1 THENA3:=IF(BKHIGH>=BKPRICE*(1+2/1000),BKHIGH*(1-1/1000),BKPRICE*(1-32/1000));B2:=IF(O<A3,O,IF(L<=A3,A3,NULL));IF BARSBK>0&&BARSBK<=1 THENB2:=IF(H>BKLOW+6*REF(VAR1,1),BKLOW+6*REF(VAR1,1),O);
VAR2:=0;HH:=IF(H>REF(C,1),H,REF(C,1));LL:=MIN(L,REF(C,1));VAR1:=MA((HH-LL),86);BOLL1:TIME>0930&&TIME<1400;VAR6:MINPRICE;VAR3:=MA(REF(H,1)-REF(L,1),2);VAR4:=MA(O,12)+4.25*VAR3;VAR5:=MA(O,12)-4.25*VAR3;BOLL4:=BOLL1&&SKVOL=0&&L<VAR5;BOLL3:=BOLL1&&BKVOL=0&&H>VAR4;VAR10:=IF(O<VAR5,O-VAR2*VAR6,VAR5-VAR2*VAR6);BOLL4,SK(1);SETSIGPRICETYPE(SK,VAR10);
A1:=IF(O>VAR4,O+VAR2*VAR6,VAR4+VAR2*VAR6);BOLL3,BK(1);SETSIGPRICETYPE(SK,A1);
SKVOL>0&&BARSSK>1,BP(1);SETSIGPRICETYPE(BP,B1);
BKVOL>0&&BARSBK>1,SP(1);SETSIGPRICETYPE(SP,B2);
有思路,想编写各种指标公式,程序化交易模型,选股公式,预警公式的朋友
可联系技术人员 QQ: 511411198 进行 有偿 编写!(不贵!点击查看价格!)
相关文章
-
没有相关内容