设为首页收藏本站

 找回密码
 注册
楼主: qsb588986
打印 上一主题 下一主题

又一个失败的策略。望大神提谐。 [复制链接]

Rank: 3Rank: 3

精华
0
UID
213396
积分
187
帖子
140
主题
26
阅读权限
40
注册时间
2015-7-10
最后登录
2023-4-14
11#
发表于 2018-8-25 21:49:26 |显示全部楼层
本帖最后由 qsb588986 于 2018-8-26 00:12 编辑

又写了一个。


Params
Numeric offset(6)        ;

Vars

Numeric totalequity;
Numeric turtleunits;
NumericSeries hh;
NumericSeries ll;
Numeric hhh;
Numeric lll;
Numeric hhhh;
Numeric llll;
Numeric gg;
Numeric aa;
NumericSeries gd;
NumericSeries count;
Numeric hbar;
Numeric lbar;
Numeric hhbar;
Numeric llbar;
Numeric hhxbar;
Numeric llxbar;
Numeric hhx;
Numeric llx;

Begin
if(isCallAuctionTime())
Return;

TotalEquity = Portfolio_CurrentCapital() + Portfolio_UsedMargin();   //账户最新资产 = 按当前Bar开盘价计算的可用资金 + 持仓保证金
TurtleUnits=(TotalEquity/(MarginRatio*ContractUnit()*BigPointValue()*Close))*6/10;
TurtleUnits = IntPart(TurtleUnits); // 对小数取整
if(0.0800<currenttime && currenttime<0.0900 && high==low or 0.1530<currenttime && currenttime<0.2100 && high==low or GetGlobalVar(0)==InvalidNumeric)
SetGlobalVar(0,0);
if(0.0800<currenttime && currenttime<0.0900 && high==low or 0.1530<currenttime && currenttime<0.2100 && high==low or GetGlobalVar(1)==InvalidNumeric)
SetGlobalVar(1,0);
if(0.0800<currenttime && currenttime<0.0900 && high==low or 0.1530<currenttime && currenttime<0.2100 && high==low or GetGlobalVar(2)==InvalidNumeric)
SetGlobalVar(2,0);
if(0.0800<currenttime && currenttime<0.0900 && high==low or 0.1530<currenttime && currenttime<0.2100 && high==low or GetGlobalVar(4)==InvalidNumeric)
SetGlobalVar(4,0);

if(time!=time[1]+0.0005 && time==0.0900 or time!=time[1]+0.0005 && time==0.2100)
count=1;
Else
count=count+1;       \\初始化周期数。

hh=Highest(High,count);    \\求当天最高价。
ll=Lowest(low,count);          \\求当天最低价。
hbar=HighestBar(High,count);      \\求当天最高价之后的BAR数。
lbar=LowestBar(low,count);          \\求当天最低价之后的BAR数。
hhh=Highest(High,lbar);                \\求当天最低价之后的最高价(次高价)。
lll=Lowest(Low,hbar);                    \\求当天最高价之后的最低价(次低价)。
hhxbar=HighestBar(high,lbar);       \\求当天次高价之后的BAR数。
llxbar=LowestBar(low,hbar);           \\求当天次低价之后的BAR数。
hhx=Highest(High,llxbar);              \\求当天次低价之后的最高价(次次高价)。
llx=lowest(low,hhxbar);                  \\求当天次高价之后的最低价(次次低价)

gd=hh-ll;

if(lll==ll && hhh!=hh && llx!=ll && llx<hhh-gd/3)
gg=llx+gd/3;
Else if(lll!=ll && hhh==hh)
gg=lll+(gd/3);
else if(ll==lll)
gg=ll+(gd/3);

if(lll!=ll && hhx!=hh && hhh!=hh && hhx==hhh && hhxbar!=0)
aa=hhx-gd/3;
Else if(hhh!=hh && lll==ll)
aa=hhh-(gd/3);
else if(hh==hhh)
aa=hh-gd/3;


if(currenttime>0.0900 && currenttime<0.1457 or currenttime>0.2100 && currenttime<0.2257)
{

if(A_BuyPosition==0 && A_SellPosition==0 && BarStatus==2 )

{
if(GetGlobalVar(0)==0 && close>gg && gd>6)
{
A_SendOrder(Enum_Buy,Enum_Entry,TurtleUnits,Q_AskPrice+offset*MinMove*PriceScale);
SetGlobalVar(0,1);
SetGlobalVar(4,1);
SetGlobalVar(2,0);

}
Else if(GetGlobalVar(4)==0 && close<aa && gd>6)
{

A_SendOrder(Enum_Sell,Enum_Entry,TurtleUnits,Q_BidPrice-offset*MinMove*PriceScale);
SetGlobalVar(0,1);
SetGlobalVar(4,1);
SetGlobalVar(1,0);

}
}

if(A_SellPosition>0 && BarStatus==2  && vol>0)
{

if(close>gg && GetGlobalVar(1)==0)
{
if(a_todaysellposition>0)
A_SendOrder(Enum_Buy,Enum_ExitToday,A_TodaySellPosition,Q_AskPrice+offset*MinMove*PriceScale);
Else
A_SendOrder(Enum_Buy,Enum_Exit,A_SellPosition,Q_AskPrice+offset*MinMove*PriceScale);
A_SendOrder(Enum_Buy,Enum_Entry,TurtleUnits,Q_AskPrice+offset*MinMove*PriceScale);
SetGlobalVar(1,2);
SetGlobalVar(2,0);

}
if(close-A_SellAvgPrice>30)
{
if(a_todaysellposition>0)
A_SendOrder(Enum_Buy,Enum_ExitToday,A_TodaySellPosition,Q_AskPrice+offset*MinMove*PriceScale);
Else
A_SendOrder(Enum_Buy,Enum_Exit,A_SellPosition,Q_AskPrice+offset*MinMove*PriceScale);
SetGlobalVar(1,1);
SetGlobalVar(2,1);
SetGlobalVar(4,1);
SetGlobalVar(0,1);
}
}
if(A_BuyPosition>0 && BarStatus==2 && vol>0)
{

if(close<aa && GetGlobalVar(2)==0)
{
if(A_TodayBuyPosition>0)
A_SendOrder(Enum_Sell,Enum_ExitToday,A_TodayBuyPosition,Q_BidPrice-offset*MinMove*PriceScale);
Else
A_SendOrder(Enum_Sell,Enum_Exit,A_BuyPosition,Q_BidPrice-offset*MinMove*PriceScale);
A_SendOrder(Enum_Sell,Enum_Entry,TurtleUnits,Q_BidPrice-offset*MinMove*PriceScale);
SetGlobalVar(2,2);
SetGlobalVar(1,0);
}

if(A_BuyAvgPrice-close>30)
{
if(A_TodayBuyPosition>0)
A_SendOrder(Enum_Sell,Enum_ExitToday,A_TodayBuyPosition,Q_BidPrice-offset*MinMove*PriceScale);
Else
A_SendOrder(Enum_Sell,Enum_Exit,A_BuyPosition,Q_BidPrice-offset*MinMove*PriceScale);
SetGlobalVar(2,1);
SetGlobalVar(1,1);
SetGlobalVar(0,1);
SetGlobalVar(4,1);
}
}
}

if(currenttime>0.1457 && currenttime<0.1500 && A_BuyPosition>0 or currenttime>0.1457 && currenttime<0.1500 && A_SellPosition>0 or currenttime>0.2257 && currenttime<0.2300 && A_BuyPosition>0 or currenttime>0.2257 && time<0.2300 && A_SellPosition>0)
{
if(A_TodayBuyPosition>0)
A_SendOrder(Enum_Sell,Enum_ExitToday,A_TodayBuyPosition,Q_BidPrice-offset*MinMove*PriceScale);
Else
A_SendOrder(Enum_Sell,Enum_Exit,A_BuyPosition,Q_BidPrice-offset*MinMove*PriceScale);
if(a_todaysellposition>0)
A_SendOrder(Enum_Buy,Enum_ExitToday,A_TodaySellPosition,Q_AskPrice+offset*MinMove*PriceScale);
Else
A_SendOrder(Enum_Buy,Enum_Exit,A_SellPosition,Q_AskPrice+offset*MinMove*PriceScale);
}
Commentary("GetGlobalVar(0)"+text(GetGlobalVar(0)));
Commentary("GetGlobalVar(4)"+text(GetGlobalVar(4)));
Commentary("GetGlobalVar(1)"+text(GetGlobalVar(1)));
Commentary("GetGlobalVar(2)"+text(GetGlobalVar(2)));
Commentary("hh="+text(hh));
Commentary("ll="+text(ll));
Commentary("vol="+text(vol));
Commentary("count"+text(count));
Commentary("gd="+text(gd));
Commentary("gg="+text(gg));
Commentary("aa="+text(aa));
Commentary("hhh="+text(hhh));
Commentary("lll="+text(lll));
Commentary("hbar="+text(hbar));
Commentary("lbar="+text(lbar));
Commentary("llxbar="+text(llxbar));
Commentary("hhx="+text(hhx));
Commentary("llx="+text(llx));
Commentary("hhxbar="+text(hhxbar));
End



//------------------------------------------------------------------------
// 编译版本:        2018/06/28 001530
// 内核版本:        V2.6.2.13
// 版权所有        qsb588986
// 更改声明        TradeBlazer Software保留对TradeBlazer平台
//                        每一版本的TradeBlazer公式修改和重写的权利
//------------------------------------------------------------------------

使用道具 举报

Rank: 3Rank: 3

精华
0
UID
213396
积分
187
帖子
140
主题
26
阅读权限
40
注册时间
2015-7-10
最后登录
2023-4-14
12#
发表于 2018-8-26 00:18:07 |显示全部楼层
还有一个。最近遇到一段启发。


Params
Numeric offset(6)        ;

Vars

Numeric totalequity;
Numeric turtleunits;
NumericSeries hh;
NumericSeries ll;
NumericSeries count;
Numeric voll;


Begin
if(isCallAuctionTime())
Return;

TotalEquity = Portfolio_CurrentCapital() + Portfolio_UsedMargin();   //账户最新资产 = 按当前Bar开盘价计算的可用资金 + 持仓保证金
TurtleUnits=(TotalEquity/(MarginRatio*ContractUnit()*BigPointValue()*Close))*6/10;
TurtleUnits = IntPart(TurtleUnits); // 对小数取整
if(0.0800<currenttime && currenttime<0.0900 && high==low or 0.1530<currenttime && currenttime<0.2100 && high==low or GetGlobalVar(0)==InvalidNumeric)
SetGlobalVar(0,0);
if(0.0800<currenttime && currenttime<0.0900 && high==low or 0.1530<currenttime && currenttime<0.2100 && high==low or GetGlobalVar(1)==InvalidNumeric)
SetGlobalVar(1,0);
if(0.0800<currenttime && currenttime<0.0900 && high==low or 0.1530<currenttime && currenttime<0.2100 && high==low or GetGlobalVar(2)==InvalidNumeric)
SetGlobalVar(2,0);
if(0.0800<currenttime && currenttime<0.0900 && high==low or 0.1530<currenttime && currenttime<0.2100 && high==low or GetGlobalVar(4)==InvalidNumeric)
SetGlobalVar(4,0);
if(currenttime>0.0850 && currenttime<0.0901 or currenttime>0.2050 && currenttime<0.2101)
{
SetGlobalVar(10,high);
SetGlobalVar(11,low);

}
if(time!=time[1]+0.0003 && time==0.0900 or time!=time[1]+0.0003 && time==0.2100)
count=1;
Else
count=count+1;
if(currenttime>0.0901 && currenttime<0.1457 or currenttime>0.2101 && currenttime<0.2257)
{
if(close>GetGlobalVar(10) && A_BuyPosition>0)
SetGlobalVar(10,high);
if(close>hh[1] && A_BuyPosition>0 && high-low>8)
SetGlobalVar(11,low);


if(close<GetGlobalVar(11) && A_SellPosition>0)
SetGlobalVar(10,high);
if(close<ll[1] && A_SellPosition>0 && high-low>8)
SetGlobalVar(11,low);
}
hh=GetGlobalVar(10);
ll=GetGlobalVar(11);
voll=Average(vol,count);
if(currenttime>0.0909 && currenttime<0.1457 or currenttime>0.2109 && currenttime<0.2257)
{

if(A_BuyPosition==0 && A_SellPosition==0 && BarStatus==2 && vol>0)

{
if(GetGlobalVar(0)==0 && close>hh[1]+2)
{
A_SendOrder(Enum_Buy,Enum_Entry,TurtleUnits,Q_AskPrice+offset*MinMove*PriceScale);
SetGlobalVar(0,1);
SetGlobalVar(4,1);
SetGlobalVar(2,0);

}
Else if(GetGlobalVar(4)==0 && close<ll[1]-2)
{

A_SendOrder(Enum_Sell,Enum_Entry,TurtleUnits,Q_BidPrice-offset*MinMove*PriceScale);
SetGlobalVar(0,1);
SetGlobalVar(4,1);
SetGlobalVar(1,0);

}
}

if(A_SellPosition>0 && BarStatus==2  && vol>0)
{

if(GetGlobalVar(1)==0 && close>hh[1]+2)
{
if(a_todaysellposition>0)
A_SendOrder(Enum_Buy,Enum_ExitToday,A_TodaySellPosition,Q_AskPrice+offset*MinMove*PriceScale);
Else
A_SendOrder(Enum_Buy,Enum_Exit,A_SellPosition,Q_AskPrice+offset*MinMove*PriceScale);
A_SendOrder(Enum_Buy,Enum_Entry,TurtleUnits,Q_AskPrice+offset*MinMove*PriceScale);
SetGlobalVar(1,2);
SetGlobalVar(2,0);

}
if(close-A_SellAvgPrice>30)
{
if(a_todaysellposition>0)
A_SendOrder(Enum_Buy,Enum_ExitToday,A_TodaySellPosition,Q_AskPrice+offset*MinMove*PriceScale);
Else
A_SendOrder(Enum_Buy,Enum_Exit,A_SellPosition,Q_AskPrice+offset*MinMove*PriceScale);
SetGlobalVar(1,1);
SetGlobalVar(2,1);
SetGlobalVar(4,1);
SetGlobalVar(0,1);
}
}
if(A_BuyPosition>0 && BarStatus==2 && vol>0)
{

if(GetGlobalVar(2)==0 && close<ll[1]-2)
{
if(A_TodayBuyPosition>0)
A_SendOrder(Enum_Sell,Enum_ExitToday,A_TodayBuyPosition,Q_BidPrice-offset*MinMove*PriceScale);
Else
A_SendOrder(Enum_Sell,Enum_Exit,A_BuyPosition,Q_BidPrice-offset*MinMove*PriceScale);
A_SendOrder(Enum_Sell,Enum_Entry,TurtleUnits,Q_BidPrice-offset*MinMove*PriceScale);
SetGlobalVar(2,2);
SetGlobalVar(1,0);
}

if(A_BuyAvgPrice-close>30)
{
if(A_TodayBuyPosition>0)
A_SendOrder(Enum_Sell,Enum_ExitToday,A_TodayBuyPosition,Q_BidPrice-offset*MinMove*PriceScale);
Else
A_SendOrder(Enum_Sell,Enum_Exit,A_BuyPosition,Q_BidPrice-offset*MinMove*PriceScale);
SetGlobalVar(2,1);
SetGlobalVar(1,1);
SetGlobalVar(0,1);
SetGlobalVar(4,1);
}
}
}

if(currenttime>0.1457 && currenttime<0.1500 && A_BuyPosition>0 or currenttime>0.1457 && currenttime<0.1500 && A_SellPosition>0 or currenttime>0.2257 && currenttime<0.2300 && A_BuyPosition>0 or currenttime>0.2257 && time<0.2300 && A_SellPosition>0)
{
if(A_TodayBuyPosition>0)
A_SendOrder(Enum_Sell,Enum_ExitToday,A_TodayBuyPosition,Q_BidPrice-offset*MinMove*PriceScale);
Else
A_SendOrder(Enum_Sell,Enum_Exit,A_BuyPosition,Q_BidPrice-offset*MinMove*PriceScale);
if(a_todaysellposition>0)
A_SendOrder(Enum_Buy,Enum_ExitToday,A_TodaySellPosition,Q_AskPrice+offset*MinMove*PriceScale);
Else
A_SendOrder(Enum_Buy,Enum_Exit,A_SellPosition,Q_AskPrice+offset*MinMove*PriceScale);
}
Commentary("GetGlobalVar(0)"+text(GetGlobalVar(0)));
Commentary("GetGlobalVar(4)"+text(GetGlobalVar(4)));
Commentary("GetGlobalVar(1)"+text(GetGlobalVar(1)));
Commentary("GetGlobalVar(2)"+text(GetGlobalVar(2)));
Commentary("GetGlobalVar(10)"+text(GetGlobalVar(10)));
Commentary("GetGlobalVar(11)"+text(GetGlobalVar(11)));
Commentary("hh[1]="+text(hh[1]));
Commentary("ll[1]="+text(ll[1]));
Commentary("voll="+text(voll));
Commentary("count="+text(count));
Commentary("currentbar="+text(CurrentBar));
End


//------------------------------------------------------------------------
// 编译版本:        2018/07/20 192438
// 内核版本:        V2.6.2.13
// 版权所有        qsb588986
// 更改声明        TradeBlazer Software保留对TradeBlazer平台
//                        每一版本的TradeBlazer公式修改和重写的权利
//------------------------------------------------------------------------

使用道具 举报

Rank: 3Rank: 3

精华
0
UID
213396
积分
187
帖子
140
主题
26
阅读权限
40
注册时间
2015-7-10
最后登录
2023-4-14
13#
发表于 2019-1-18 15:40:17 |显示全部楼层
本帖最后由 qsb588986 于 2019-1-18 15:56 编辑

又一新的。赚到飞!
Params
Numeric offset(6)        ;

Vars

Numeric totalequity;
Numeric turtleunits;

Numeric hlvol;
Numeric hlvoll;
Numeric voll;
Numeric dvol;
Numeric h1;
Numeric l1;
Numeric hh;
Numeric ll;
Numeric hhh;
Numeric lll;
Numeric hb;
Numeric lb;
Numeric hhb;
Numeric llb;
Numeric hhhb;
Numeric lllb;
Numeric hhhhb;
Numeric llllb;
Numeric vollh;
Numeric volll;
Numeric vollhh;
Numeric vollll;
Numeric vollhhh;
Numeric volllll;
Numeric vollhhhh;
Numeric vollllll;
Numeric hlhl;
Numeric lhlh;
Numeric zzzz;
Numeric hbt;
Numeric lbt;
Numeric dvolt;
Numeric dvoltl;
NumericSeries hlvolt;
NumericSeries hlvollt;
NumericSeries count;
NumericSeries htt;
NumericSeries ltt;
Numeric hyy;
Numeric lyy;
Numeric hvol;
Numeric lvol;
Numeric hyyy;
Numeric lyyy;
Numeric hhvol;
Numeric llvol;
Numeric hyyyy;
Numeric lyyyy;
Numeric hhhvol;
Numeric lllvol;
Numeric hyyyyy;
Numeric lyyyyy;
Numeric hhhhvol;
Numeric llllvol;
Numeric hhhvol1;
Numeric lllvol1;



Begin
if(isCallAuctionTime())
Return;

TotalEquity = Portfolio_CurrentCapital() + Portfolio_UsedMargin();   //账户最新资产 = 按当前Bar开盘价计算的可用资金 + 持仓保证金
TurtleUnits=(TotalEquity/(MarginRatio*ContractUnit()*BigPointValue()*Close))*6/10;
TurtleUnits = IntPart(TurtleUnits); // 对小数取整
if(GetGlobalVar(13)!=8 && BarStatus==2 && time==0.0900 || GetGlobalVar(13)!=8 && BarStatus==2 && time==0.2100)      \\每天开盘初始化
{
SetGlobalVar(13,8);
SetGlobalVar(1,1);
SetGlobalVar(2,1);
SetGlobalVar(3,0);
SetGlobalVar(4,0);
}
Else If(Time!=0.0900 && Time!=0.2100)
SetGlobalVar(13,1);

if(GetGlobalVar(14)!=8 && BarStatus==2)
{
SetGlobalVar(14,8);
SetGlobalVar(1,1);
SetGlobalVar(2,1);
SetGlobalVar(3,0);
SetGlobalVar(4,0);
}
if(time!=time[1]+0.0001 && time==0.0900 or time!=time[1]+0.0001 && time==0.2100)
{
count=1;
SetGlobalVar(30,0);
SetGlobalVar(31,0);
}
Else
count=count+1;
h1=Highest(high,count);    \\求距最近的最高最低价BAR数。
l1=Lowest(low,count);
hb=HighestBar(High,count);
lb=LowestBar(low,count);
hh=Highest(High,lb);
ll=Lowest(low,hb);
hhb=HighestBar(High,lb);
llb=LowestBar(low,hb);
hhh=Highest(High,llb);
lll=Lowest(low,hhb);
hhhb=HighestBar(High,llb);
lllb=LowestBar(Low,hhb);
hhhhb=HighestBar(High,lllb);
llllb=LowestBar(Low,hhhb);

voll=Average(vol,count);
vollh=Summation(vol,hb+1);
volll=Summation(vol,lb+1);
vollhh=Summation(vol,hhb+1);
vollll=Summation(vol,llb+1);
vollhhh=Summation(vol,hhhb+1);
volllll=Summation(vol,lllb+1);
vollhhhh=Summation(vol,hhhhb+1);
vollllll=Summation(vol,llllb+1);

hyy=Highest(High,lb+1);           \\最高价和最低差
lyy=Lowest(low,hb+1);
hyyy=Highest(High,llb+1);
lyyy=Lowest(low,hhb+1);
hyyyy=Highest(High,lllb+1);
lyyyy=Lowest(low,hhhb+1);
hyyyyy=Highest(High,llllb+1);
lyyyyy=Lowest(low,hhhhb+1);



hvol=(close-l1)*volll;              \\量价比
lvol=(h1-close)*vollh*-1;
hhvol=(close-lyy)*vollll;
llvol=(hyy-close)*vollhh*-1;
hhhvol=(close-lyyy)*vollhhh;
lllvol=(hyyy-close)*vollhhh*-1;
hhhvol1=(close-lyyy)*volllll;
lllvol1=(hyyy-close)*volllll*-1;
hhhhvol=(close-lyyyyy)*vollhhhh;
llllvol=(hyyyyy-close)*vollllll*-1;





if(currenttime>0.0900 && currenttime<0.1458 or currenttime>0.2100 && currenttime<0.2258)        \\开仓
{

if(A_BuyPosition==0 && A_SellPosition==0 && BarStatus==2 )

{
if(GetGlobalVar(3)==0 && hvol>100000 && abs(hvol)>abs(lvol))
{
A_SendOrder(Enum_Buy,Enum_Entry,TurtleUnits,Q_AskPrice+offset*MinMove*PriceScale);
SetGlobalVar(3,1);
SetGlobalVar(2,1);
SetGlobalVar(4,1);
SetGlobalVar(10,hvol);
}
Else if(GetGlobalVar(4)==0 && lvol<-100000 && abs(lvol)>abs(hvol))
{

A_SendOrder(Enum_Sell,Enum_Entry,TurtleUnits,Q_BidPrice-offset*MinMove*PriceScale);
SetGlobalVar(4,1);
SetGlobalVar(1,1);
SetGlobalVar(3,1);
SetGlobalVar(11,lvol);
}
}

if(GetGlobalVar(1)==1 && hhhvol1>100000 && Abs(hhhvol1)>Abs(lllvol1)  && Close-lyyy>hyyy-close+2 && A_SellPosition>0 && BarStatus==2 )      \\反手
{
if(a_todaysellposition>0)
A_SendOrder(Enum_Buy,Enum_ExitToday,A_TodaySellPosition,Q_AskPrice+offset*MinMove*PriceScale);
Else
A_SendOrder(Enum_Buy,Enum_Exit,A_SellPosition,Q_AskPrice+offset*MinMove*PriceScale);
A_SendOrder(Enum_Buy,Enum_Entry,TurtleUnits,Q_AskPrice+offset*MinMove*PriceScale);
SetGlobalVar(1,2);
SetGlobalVar(2,1);
SetGlobalVar(10,hhhvol);
}




if(GetGlobalVar(2)==1 && lllvol<-100000 && Abs(lllvol)>Abs(hhhvol)  && hyyy-close>close-lyyy+2 && A_BuyPosition>0 && BarStatus==2)      \\反手
{
if(A_TodayBuyPosition>0)
A_SendOrder(Enum_Sell,Enum_ExitToday,A_TodayBuyPosition,Q_BidPrice-offset*MinMove*PriceScale);
Else
A_SendOrder(Enum_Sell,Enum_Exit,A_BuyPosition,Q_BidPrice-offset*MinMove*PriceScale);
A_SendOrder(Enum_Sell,Enum_Entry,TurtleUnits,Q_BidPrice-offset*MinMove*PriceScale);
SetGlobalVar(2,2);
SetGlobalVar(1,1);
SetGlobalVar(11,lllvol);
}




}
if(A_GetOpenOrderCount==0)        \\收盘前平仓
SetGlobalVar(20,0);
Else
SetGlobalVar(20,1);
if(currenttime>0.1458 && currenttime<0.1500 && A_BuyPosition>0 && GetGlobalVar(20)==0 or currenttime>0.1458 && currenttime<0.1500 && A_SellPosition>0 && GetGlobalVar(20)==0 or currenttime>0.2258 && currenttime<0.2300 && A_BuyPosition>0 && GetGlobalVar(20)==0 or currenttime>0.2258 && time<0.2300 && A_SellPosition>0 && GetGlobalVar(20)==0)
{
if(A_TodayBuyPosition>0)
{
A_SendOrder(Enum_Sell,Enum_ExitToday,A_TodayBuyPosition,Q_BidPrice-offset*MinMove*PriceScale);
SetGlobalVar(20,2);
}
Else
{
A_SendOrder(Enum_Sell,Enum_Exit,A_BuyPosition,Q_BidPrice-offset*MinMove*PriceScale);
SetGlobalVar(20,2);
}
if(a_todaysellposition>0)
{
A_SendOrder(Enum_Buy,Enum_ExitToday,A_TodaySellPosition,Q_AskPrice+offset*MinMove*PriceScale);
SetGlobalVar(20,2);
}
Else
{
A_SendOrder(Enum_Buy,Enum_Exit,A_SellPosition,Q_AskPrice+offset*MinMove*PriceScale);
SetGlobalVar(20,2);
}
}

Commentary("GetGlobalVar(3)"+text(GetGlobalVar(3)));
Commentary("GetGlobalVar(4)"+text(GetGlobalVar(4)));
Commentary("GetGlobalVar(1)"+text(GetGlobalVar(1)));
Commentary("GetGlobalVar(2)"+text(GetGlobalVar(2)));
Commentary("GetGlobalVar(10)"+text(GetGlobalVar(10)));
Commentary("GetGlobalVar(11)"+text(GetGlobalVar(11)));
Commentary("GetGlobalVar(13)"+text(GetGlobalVar(13)));
Commentary("GetGlobalVar(14)"+text(GetGlobalVar(14)));
/*Commentary("hlvol="+Text(hlvol));
Commentary("hlvoll="+Text(hlvoll));
Commentary("voll="+Text(voll));
Commentary("h1="+Text(h1));
Commentary("l1="+Text(l1));
Commentary("hh="+Text(hh));
Commentary("ll="+Text(ll));
Commentary("hhh="+Text(hhh));
Commentary("lll="+Text(lll));
Commentary("vollh="+Text(vollh));
Commentary("volll="+Text(volll));
Commentary("vollhh="+Text(vollhh));
Commentary("vollll="+Text(vollll));
Commentary("vollhhh="+Text(vollhhh));
Commentary("volllll="+Text(volllll));
Commentary("hlhl="+Text(hlhl));
Commentary("lhlh="+Text(lhlh));*/
Commentary("count="+Text(count));
Commentary("hb="+Text(hb));
Commentary("lb="+Text(lb));
Commentary("hhb="+Text(hhb));
Commentary("llb="+Text(llb));
Commentary("hhhb="+Text(hhhb));
Commentary("lllb="+Text(lllb));
Commentary("hhhhb="+Text(hhhhb));
Commentary("llllb="+Text(llllb));
Commentary("hyyy-close="+Text(hyyy-close));
Commentary("close-lyyy="+Text(close-lyyy));
Commentary("hvol="+Text(hvol));
Commentary("lvol="+Text(lvol));
Commentary("hhvol="+Text(hhvol));
Commentary("llvol="+Text(llvol));
Commentary("hhhvol="+Text(hhhvol));
Commentary("lllvol="+Text(lllvol));
Commentary("hhhhvol="+Text(hhhhvol));
Commentary("llllvol="+Text(llllvol));
Commentary("hhhvol1="+Text(hhhvol1));
Commentary("lllvol1="+Text(lllvol1));

End


//------------------------------------------------------------------------
// 编译版本:        2018/12/14 173649
// 内核版本:        V2.8.2.14
// 版权所有        qsb588986
// 更改声明        TradeBlazer Software保留对TradeBlazer平台
//                        每一版本的TradeBlazer公式修改和重写的权利
//------------------------------------------------------------------------

使用道具 举报

Rank: 3Rank: 3

精华
0
UID
213396
积分
187
帖子
140
主题
26
阅读权限
40
注册时间
2015-7-10
最后登录
2023-4-14
14#
发表于 2019-2-23 16:46:58 |显示全部楼层
又一个最新最爆的终极策略。赚到飞!
// 简称: wanneng
// 名称: wanneng
// 类别: 公式应用
// 类型: 用户应用
// 输出: Void
//------------------------------------------------------------------------
Params
Numeric offset(6);       

Vars
NumericSeries cc;
NumericSeries bb;
Numeric totalequity;
Numeric turtleunits;
Numeric hh;
Numeric hl;
Numeric lh;
Numeric ll;
Numeric hvol;
Numeric volh;
Numeric lvol;
Numeric voll;
NumericSeries hh1;
NumericSeries ll1;
Begin

if(isCallAuctionTime())
Return;

TotalEquity = Portfolio_CurrentCapital() + Portfolio_UsedMargin();   //账户最新资产 = 按当前Bar开盘价计算的可用资金 + 持仓保证金
TurtleUnits=(TotalEquity/(MarginRatio*ContractUnit()*BigPointValue()*Close))*6/10;
TurtleUnits = IntPart(TurtleUnits); // 对小数取整
if(GetGlobalVar(43)!=8 && BarStatus==2 && time==0.0900 || GetGlobalVar(43)!=8 && BarStatus==2 && time==0.2100)
{
SetGlobalVar(43,8);
SetGlobalVar(1,1);
SetGlobalVar(2,1);
SetGlobalVar(3,0);
SetGlobalVar(4,0);
}
Else If(Time!=0.0900 && Time!=0.2100)
SetGlobalVar(43,1);

if(GetGlobalVar(44)!=8 && BarStatus==2)
{
SetGlobalVar(44,8);
SetGlobalVar(1,1);
SetGlobalVar(2,1);
SetGlobalVar(3,0);
SetGlobalVar(4,0);
}

if(a_buyposition>0)
cc=0;
Else if(close<low[1] && close<low[2] && Close<low[4] && hh1[1]-close>4)
{
cc=1;
SetGlobalVar(50,1);
SetGlobalVar(51,2);
}
Else if(GetGlobalVar(51)!=1)
cc=cc+1;

if(a_sellposition>0)
bb=0;
else if(high>high[1] && high>high[2] && high>high[4] && close-ll1[1]>4)
{
bb=1;
SetGlobalVar(51,1);
SetGlobalVar(50,2);
}
Else if(GetGlobalVar(50)!=1)
bb=bb+1;




hh1=Highest(high,4);
ll1=Lowest(low,4);
hh=Highest(high,cc);
hl=Lowest(low,cc);
volh=Summation(vol,cc);
hvol=(close-hl)*volh;
lh=Highest(high,bb);
ll=Lowest(low,bb);
voll=Summation(vol,bb);
lvol=(lh-close)*voll*-1;


if(currenttime>0.0900 && currenttime<0.1458 or currenttime>0.2100 && currenttime<0.2258)
{

if(A_BuyPosition==0 && A_SellPosition==0 && BarStatus==2 )

{
if(GetGlobalVar(3)==0 && hvol>200000 && abs(hvol)>abs(lvol))
{
A_SendOrder(Enum_Buy,Enum_Entry,TurtleUnits,Q_AskPrice+offset*MinMove*PriceScale);
SetGlobalVar(3,1);
SetGlobalVar(2,1);
SetGlobalVar(4,1);
SetGlobalVar(30,hvol);
}
Else if(GetGlobalVar(4)==0 && lvol<-200000 && abs(lvol)>abs(hvol))
{

A_SendOrder(Enum_Sell,Enum_Entry,TurtleUnits,Q_BidPrice-offset*MinMove*PriceScale);
SetGlobalVar(4,1);
SetGlobalVar(1,1);
SetGlobalVar(3,1);
SetGlobalVar(31,lvol);
}
}
if(GetGlobalVar(1)==1 && hvol>200000  && abs(hvol)>abs(lvol) && close-low>high-close+2 && A_SellPosition>0 && BarStatus==2 )
{
if(a_todaysellposition>0)
A_SendOrder(Enum_Buy,Enum_ExitToday,A_TodaySellPosition,Q_AskPrice+offset*MinMove*PriceScale);
Else
A_SendOrder(Enum_Buy,Enum_Exit,A_SellPosition,Q_AskPrice+offset*MinMove*PriceScale);
A_SendOrder(Enum_Buy,Enum_Entry,TurtleUnits,Q_AskPrice+offset*MinMove*PriceScale);
SetGlobalVar(1,2);
SetGlobalVar(2,1);
SetGlobalVar(32,hvol);
}
if(GetGlobalVar(2)==1 && lvol<-200000 && abs(lvol)>abs(hvol) && high-close>close-low+2 && A_BuyPosition>0 && BarStatus==2)
{
if(A_TodayBuyPosition>0)
A_SendOrder(Enum_Sell,Enum_ExitToday,A_TodayBuyPosition,Q_BidPrice-offset*MinMove*PriceScale);
Else
A_SendOrder(Enum_Sell,Enum_Exit,A_BuyPosition,Q_BidPrice-offset*MinMove*PriceScale);
A_SendOrder(Enum_Sell,Enum_Entry,TurtleUnits,Q_BidPrice-offset*MinMove*PriceScale);
SetGlobalVar(2,2);
SetGlobalVar(1,1);
SetGlobalVar(33,lvol);
}
}


if(A_GetOpenOrderCount==0)
SetGlobalVar(20,0);
Else
SetGlobalVar(20,1);
if(currenttime>0.1458 && currenttime<0.1500 && A_BuyPosition>0 && GetGlobalVar(20)==0 or currenttime>0.1458 && currenttime<0.1500 && A_SellPosition>0 && GetGlobalVar(20)==0 or currenttime>0.2258 && currenttime<0.2300 && A_BuyPosition>0 && GetGlobalVar(20)==0 or currenttime>0.2258 && time<0.2300 && A_SellPosition>0 && GetGlobalVar(20)==0)
{
if(A_TodayBuyPosition>0)
{
A_SendOrder(Enum_Sell,Enum_ExitToday,A_TodayBuyPosition,Q_BidPrice-offset*MinMove*PriceScale);
SetGlobalVar(20,2);
}
Else
{
A_SendOrder(Enum_Sell,Enum_Exit,A_BuyPosition,Q_BidPrice-offset*MinMove*PriceScale);
SetGlobalVar(20,2);
}
if(a_todaysellposition>0)
{
A_SendOrder(Enum_Buy,Enum_ExitToday,A_TodaySellPosition,Q_AskPrice+offset*MinMove*PriceScale);
SetGlobalVar(20,2);
}
Else
{
A_SendOrder(Enum_Buy,Enum_Exit,A_SellPosition,Q_AskPrice+offset*MinMove*PriceScale);
SetGlobalVar(20,2);
}
}
Commentary("cc="+text(cc));
Commentary("bb="+text(bb));
Commentary("hvol="+text(hvol));
Commentary("lvol="+text(lvol));       
Commentary("GetGlobalVar(1)="+text(GetGlobalVar(1)));
Commentary("GetGlobalVar(2)="+text(GetGlobalVar(2)));
Commentary("GetGlobalVar(3)="+text(GetGlobalVar(3)));
Commentary("GetGlobalVar(4)="+text(GetGlobalVar(4)));
Commentary("GetGlobalVar(30)="+text(GetGlobalVar(30)));
Commentary("GetGlobalVar(31)="+text(GetGlobalVar(31)));
Commentary("GetGlobalVar(32)="+text(GetGlobalVar(32)));
Commentary("GetGlobalVar(33)="+text(GetGlobalVar(33)));
Commentary("GetGlobalVar(43)="+text(GetGlobalVar(43)));
Commentary("GetGlobalVar(44)="+text(GetGlobalVar(44)));
End


//------------------------------------------------------------------------
// 编译版本:        2019/02/21 172011
// 内核版本:        V2.8.2.14
// 版权所有        qsb588986
// 更改声明        TradeBlazer Software保留对TradeBlazer平台
//                        每一版本的TradeBlazer公式修改和重写的权利
//------------------------------------------------------------------------

使用道具 举报

Rank: 3Rank: 3

精华
0
UID
213396
积分
187
帖子
140
主题
26
阅读权限
40
注册时间
2015-7-10
最后登录
2023-4-14
15#
发表于 2019-7-7 20:47:22 |显示全部楼层
本帖最后由 qsb588986 于 2019-7-7 21:48 编辑

又一个新的。吃到肉。
Params
Numeric offset(6)        ;

Vars

Numeric totalequity;
Numeric turtleunits;
NumericSeries count;

Begin


TotalEquity = A_FreeMargin + A_TotalMargin;   //账户最新资产 = 按当前Bar开盘价计算的可用资金 + 持仓保证金
TurtleUnits=(TotalEquity/(MarginRatio*ContractUnit()*BigPointValue()*Close)*1/5);
TurtleUnits = IntPart(TurtleUnits); // 对小数取整
if(GetGlobalVar(13)!=8 && BarStatus==2 && time==0.0900 || GetGlobalVar(13)!=8 && BarStatus==2 && time==0.2100)
{
SetGlobalVar(1,1);
SetGlobalVar(2,1);
SetGlobalVar(0,1);
SetGlobalVar(4,1);
SetGlobalVar(20,1);
SetGlobalVar(21,1);
SetGlobalVar(102,0);
SetGlobalVar(103,0);
}
Else If(Time!=0.0900 && Time!=0.2100)
SetGlobalVar(13,1);


if(GetGlobalVar(14)!=8 && BarStatus==2 )
{
SetGlobalVar(14,8);
SetGlobalVar(1,1);
SetGlobalVar(2,1);
SetGlobalVar(0,1);
SetGlobalVar(4,1);
SetGlobalVar(20,1);
SetGlobalVar(21,1);
SetGlobalVar(100,0);
SetGlobalVar(101,0);
SetGlobalVar(102,0);
SetGlobalVar(103,0);
}

if(GetGlobalVar(21)==1 && BarStatus==2)
{
SetGlobalVar(33,Close);
SetGlobalVar(34,Close);
SetGlobalVar(21,2);
}

if(Close>GetGlobalVar(33) && Close>GetGlobalVar(34) && GetGlobalVar(100)==0)
{
SetGlobalVar(33,Close);
SetGlobalVar(34,High);
}
else if(Close>GetGlobalVar(33) && Close<=GetGlobalVar(34))
{
SetGlobalVar(33,Close);
SetGlobalVar(34,High);
}
else if(Close<GetGlobalVar(33))
SetGlobalVar(33,Close);
if(Close<GetGlobalVar(35) && Close<GetGlobalVar(36) && GetGlobalVar(101)==0)
{
SetGlobalVar(35,Close);
SetGlobalVar(36,Low);
}
else if(Close<GetGlobalVar(35) && Close>=GetGlobalVar(36))
{
SetGlobalVar(35,Close);
SetGlobalVar(36,Low);
}
else if(Close>GetGlobalVar(35))
SetGlobalVar(35,Close);


if(Time+0.000002>CurrentTime && GetGlobalVar(9)!=9)
{
SetGlobalVar(100,0);
SetGlobalVar(102,0);
SetGlobalVar(9,9);
}
Else if(CurrentTime>time+0.000002)
SetGlobalVar(9,1);
if(Close>GetGlobalVar(34))
SetGlobalVar(100,0);
else if(Close==High)
{
SetGlobalVar(100,GetGlobalVar(100)+Q_AskVol);
if(GetGlobalVar(100)>=GetGlobalVar(102))
SetGlobalVar(102,GetGlobalVar(100));
}

if(Time+0.000002>CurrentTime && GetGlobalVar(10)!=10)
{
SetGlobalVar(101,0);
SetGlobalVar(103,0);
SetGlobalVar(10,10);
}
Else if(CurrentTime>time+0.000002)
SetGlobalVar(10,1);
if(Close<GetGlobalVar(36))
SetGlobalVar(101,0);
else if(Close==Low)
{
SetGlobalVar(101,GetGlobalVar(101)+Q_AskVol);
if(GetGlobalVar(101)>=GetGlobalVar(103))
SetGlobalVar(103,GetGlobalVar(101));
}


if(time!=time[1]+0.0001 && time==0.0900 or time!=time[1]+0.0001 && time==0.2100)
count=1;
Else
count=count+1;

If(GetGlobalVar(102)>=2* GetGlobalVar(103) && GetGlobalVar(102)>12000)
{
SetGlobalVar(91,1);
SetGlobalVar(92,2);
setglobalvar(109,high);
}
If(GetGlobalVar(103)>=2*GetGlobalVar(102) && GetGlobalVar(103)>12000)
{
SetGlobalVar(92,1);
SetGlobalVar(91,2);
setglobalvar(110,low);
}

if(currenttime>0.090 && currenttime<0.1458 or currenttime>0.2100 && currenttime<0.2258)
{

if(A_BuyPosition==0 && A_SellPosition==0 && BarStatus==2 && vol>0)

{
if(GetGlobalVar(0)==1 && GetGlobalVar(91)==1 && Close>GetGlobalVar(109))
{
A_SendOrder(Enum_Buy,Enum_Entry,TurtleUnits,Q_AskPrice+offset*MinMove*PriceScale);
SetGlobalVar(0,2);
SetGlobalVar(4,2);
SetGlobalVar(2,1);
}
Else if(GetGlobalVar(4)==1 && GetGlobalVar(92)==1 && Close<GetGlobalVar(110))
{

A_SendOrder(Enum_Sell,Enum_Entry,TurtleUnits,Q_BidPrice-offset*MinMove*PriceScale);
SetGlobalVar(4,2);
SetGlobalVar(0,2);
SetGlobalVar(1,1);
}
}

if(A_SellPosition>0 && BarStatus==2  && vol>0)
{

if(GetGlobalVar(1)==1 && GetGlobalVar(91)==1 && Close>GetGlobalVar(109))
{
if(a_todaysellposition>0)
A_SendOrder(Enum_Buy,Enum_ExitToday,A_TodaySellPosition,Q_AskPrice+offset*MinMove*PriceScale);
Else
A_SendOrder(Enum_Buy,Enum_Exit,A_SellPosition,Q_AskPrice+offset*MinMove*PriceScale);
A_SendOrder(Enum_Buy,Enum_Entry,TurtleUnits,Q_AskPrice+offset*MinMove*PriceScale);
SetGlobalVar(1,2);
SetGlobalVar(2,1);
}
}


if(A_BuyPosition>0 && BarStatus==2 && vol>0)
{

if(GetGlobalVar(2)==1 && GetGlobalVar(92)==1 && Close<GetGlobalVar(110))
{
if(A_TodayBuyPosition>0)
A_SendOrder(Enum_Sell,Enum_ExitToday,A_TodayBuyPosition,Q_BidPrice-offset*MinMove*PriceScale);
Else
A_SendOrder(Enum_Sell,Enum_Exit,A_BuyPosition,Q_BidPrice-offset*MinMove*PriceScale);
A_SendOrder(Enum_Sell,Enum_Entry,TurtleUnits,Q_BidPrice-offset*MinMove*PriceScale);
SetGlobalVar(2,2);
SetGlobalVar(1,1);
}
}


}
if(A_GetOpenOrderCount==0)
SetGlobalVar(20,0);
Else
SetGlobalVar(20,1);
if(currenttime>0.1458 && currenttime<0.1500 && A_BuyPosition>0 or currenttime>0.1458 && currenttime<0.1500 && A_SellPosition>0 or currenttime>0.2258 && currenttime<0.2300 && A_BuyPosition>0 or currenttime>0.2258 && time<0.2300 && A_SellPosition>0)
{
if(A_TodayBuyPosition>0)
{
A_SendOrder(Enum_Sell,Enum_ExitToday,A_TodayBuyPosition,Q_BidPrice-offset*MinMove*PriceScale);
SetGlobalVar(20,1);
}
Else
{
A_SendOrder(Enum_Sell,Enum_Exit,A_BuyPosition,Q_BidPrice-offset*MinMove*PriceScale);
SetGlobalVar(20,1);
}
if(a_todaysellposition>0)
{
A_SendOrder(Enum_Buy,Enum_ExitToday,A_TodaySellPosition,Q_AskPrice+offset*MinMove*PriceScale);
SetGlobalVar(20,1);
}
Else
{
A_SendOrder(Enum_Buy,Enum_Exit,A_SellPosition,Q_AskPrice+offset*MinMove*PriceScale);
SetGlobalVar(20,1);
}
}

End

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

bottom

静态版|手机版|联系我们|交易开拓者 ( 粤ICP备07044698   

GMT+8, 2024-5-20 15:44

Powered by Discuz! X2 LicensedChrome插件扩展

© 2011-2012 交易开拓者 Inc.

回顶部