//------------------------------------------------------------------------
// 简称: JY
// 名称:盈多亏少
// 类别: 公式应用
// 类型: 用户应用
// 输出:
//------------------------------------------------------------------------
Params
Bool bInitStatus(false);
Numeric InitMP(0);
Numeric MidLinel(5600);
Numeric MidLineLength(250);
Numeric FirstGrid(3);
Numeric TotalGrids(10);
Numeric GridInterval(3);
Numeric WinGrid(3);
Numeric EveryLots(1);
Numeric MidLineWeieht(1);
Numeric ExitOnCloseMins(14.50);
Vars
Numeric MidLineWeight;
NumericSeries midline;
Numeric MinPoint;
Numeric AvgOfClose;
Numeric AskLine;
Numeric BidLine;
NumericSeries RealMidLine;
Numeric MyRealMp(0);
Numeric TmpGridIndex;
Numeric TmpPrice;
Numeric TmpPriee;
Numeric OpenDPrice;
Begin
penDPrice= opend;
if(dayday[1])
{
midline=OpenDPrice;
}Else
{
midline=midline[1];
}
MinPoint=MinMove*PriceScale;
MyRealMp=GetGlobalvar (0);
AvgOfClose =AverageFC(Close, MidLineLength);
If (BarStatus== O)
{
If(MyRealMp == InvalidNumeric || bInitStatus)
{
MyRealMp=InitMP;
SetGlobalVar(0,MyRealMp);
}Else
If(BarStatus==2A_AccountID!="")
{
If(Q_AskPrice RealMidLine+FirstGrid*MinPoint)
{
TmpPrice=RealMidLine+FirstGrid*MinPoint+Abs (MyRealMp)* (GridInterval*MinPoint);
TmpPriee=Ceiling (TmpPrice, Minpoint);
Commentary ("开仓价="+text (TmpPrice));
TmpGridIndex=1- IntPart ((BidLine-RealMidLine -FirstGrid*MinPoint)/(GridInterval*MinPoint));
If(TmpGridIndex=-1*TotalGrids)
{
MyRealMp=MyRealMp-1;
A_SendOrder (Enum_Buy, Enum_Entry, EveryLots, BidLine);
}//来源:
}Else
If(MyRealMp>=0 AskLineMyRealMp TmpGridIndexO)
{
TmpPrice=RealMidLine-FirstGrid*MinPoint - (Abs (MyRealMp) -1) * (GridInterval*MinPoint) +WinGrid*MinPoint;
TmpPrice = Ceiling(TmpPrice, MinPoint);
Commentary ("平仓价 ="+Text (TmpPriee));
}Else
If (MyRealMpMyRealMp)
{
MyRealMp=MyRealMp+1;
A_SendOrder (Enum_Sell, Enum_Exit, EveryLots,AskLine);
TmpGridIndex=1+IntPart((RealMidLine-FirstGrid*MinPoint+WinGrid*MinPoint-BidLine)/(GridInterval*MinPoint));
TmpGridIndex=max (0, TmpGridIndex);
}
If(TmpGridIndex ExitOnCloseMins/100)
{
If(MyRealMp>0)
{
MyRealMp=MyRealMp-1;
A_SendOrder(Enum_Sell,Enum_Exit,EveryLots,BidLine);
}Else
If(MyRealMp0.145000 and CurrentTime<0.150000)
{
A_SendOrder(Enum_Sell,Enum_Exit,1,Q_BidPrice);
A_SendOrder(Enum_Buy,Enum_Exit,1,Q_AskPrice);
}
End
//------------------------------------------------------------------------
// 编译版本GS2010.12.08
// 用户版本2012/09/10 11:16
// 版权所有
// 更改声明TradeBlazer Software保留对TradeBlazer平台
//每一版本的TrabeBlazer公式修改和重写的权利
//------------------------------------------------------------------------