开拓者左右互博 日内随机交易策略源码-开拓者公式 -程序化交易(grahamobil.com) - 365bet送体验金
您现在的位置:程序化交易>> 期货公式>> 交易开拓者(TB)>> 开拓者公式>>正文内容

365bet送体验金

开拓者左右互博 日内随机交易策略源码

//------------------------------------------------------------------------
// 简称: LeftRightTrading
// 名称: LeftRightTrading
// 类别: 公式应用
// 类型: 用户应用
//------------------------------------------------------------------------
Params
        Bool bInitStatus(False);
    Numeric InitMyRealMP(0);
    Numeric InitPreMyRealMP(0);
        Numeric FirstGrid(5);
        Numeric TotalGrids(10);
        Numeric GridInterval(5);
        Numeric WinGrid(5);
        Numeric EveryLots(1);
        Numeric OffSet(1);
       
        Numeric StyleChangeGrid(3);
        Bool ProgramTest(False);//是否测试 True 是 False 实盘
       
Vars
        NumericSeries MidLine;
        Numeric MinPoint;
        Numeric AskLine;
        Numeric BidLine;
        Numeric RealMidLine;
        Numeric MyRealMP(0);
        Numeric TmpGridIndex;
        Numeric qcbz;
        Bool TradeTime;
        Numeric TmpLots;
        Numeric PreRealMidLine;
        Numeric PreMyRealMP;
        Numeric MyBuyPosition;
        Numeric MySellPosition;
        Numeric EndTime;
        Bool        bJudgeTime;       
        Numeric ExitOnCloseMins(14.58);
       
        //Debug
        String FilePath;
       
Begin
        If((Weekday()!=5)&&(Weekday()!=6)&&(Weekday()!=7)){EndTime=0.151500;ExitOnCloseMins=15.13;}
        If(Weekday()==5){EndTime=0.150000;ExitOnCloseMins=14.58;}
        If(!ProgramTest)TradeTime=(Q_LastTime>=0.091500 And CurrentTime>0.091500 And CurrentTime<0.113000) Or (CurrentTime>0.130000 And CurrentTime<EndTime);
        If(ProgramTest)TradeTime=(CurrentTime>0.091500 And CurrentTime<0.113000) Or (CurrentTime>0.130000 And CurrentTime<EndTime);
       
        FilePath="C:\\LeftRightTrading_ea.txt";
       
        MyRealMP=GetGlobalVar(0);
        qcbz=GetGlobalVar(1);
        PreRealMidLine=GetGlobalVar(2);
        PreMyRealMP=GetGlobalVar(3);
        If(BarStatus==0 And (MyRealMP==InvalidNumeric || bInitStatus))
        {
                //If(A_BuyPosition>0)MyRealMP=A_BuyPosition;
                //Else If(A_SellPosition>0)MyRealMP=-1*A_SellPosition;
                //Else MyRealMP=InitMyRealMP;
                MyRealMP=InitMyRealMP;
                PreMyRealMP=InitPreMyRealMP;
               
        }
       
        If((Weekday()!=5)&&(Weekday()!=6)&&(Weekday()!=7))
                bJudgeTime=(Time==0.091500 Or Time==0.092500 Or Time==0.093500 Or Time==0.094500 Or Time==0.095500 Or Time==0.100500 Or Time==0.101500 Or Time==0.102500 Or Time==0.103500 Or Time==0.104500 Or Time==0.105500 Or Time==0.110500 Or Time==0.111500 Or Time==0.112500 Or Time==0.130000  Or Time==0.131000  Or Time==0.132000  Or Time==0.133000 Or Time==0.134000 Or Time==0.135000 Or Time==0.140000 Or Time==0.141000 Or Time==0.142000 Or Time==0.14300 Or Time==0.144000 Or Time==0.145000 Or Time==0.150000 Or Time==0.151000);
        If(Weekday()==5)
                bJudgeTime=(Time==0.091500 Or Time==0.092500 Or Time==0.093500 Or Time==0.094500 Or Time==0.095500 Or Time==0.100500 Or Time==0.101500 Or Time==0.102500 Or Time==0.103500 Or Time==0.104500 Or Time==0.105500 Or Time==0.110500 Or Time==0.111500 Or Time==0.112500 Or Time==0.130000  Or Time==0.131000  Or Time==0.132000  Or Time==0.133000 Or Time==0.134000 Or Time==0.135000 Or Time==0.140000 Or Time==0.141000 Or Time==0.142000 Or Time==0.14300 Or Time==0.144000 Or Time==0.145000);
        If(bJudgeTime)
        {
                MidLine=Open;
                PreRealMidLine=MidLine[1];
        }
        Else
        {
                MidLine=MidLine[1];
        }
        RealMidLine=MidLine;
        MinPoint=MinMove*PriceScale;
        If(!ProgramTest)AskLine=Q_AskPrice;Else AskLine=High;
        If(!ProgramTest)BidLine=Q_BidPrice;Else BidLine=Low;
        If(!ProgramTest)MyBuyPosition=A_BuyPosition;
        If(!ProgramTest)MySellPosition=A_SellPosition;
       
               
        If(BarStatus==2 && A_AccountID!="" && TradeTime)
        {
                If(Q_AskPrice<=0 || Q_BidPrice<=0) Return;
                If(Q_BidPrice==Q_UpperLimit || Q_AskPrice ==Q_LowerLimit) Return;
                If(High==Low)Return;
                If((Weekday()!=5)&&(Weekday()!=6)&&(Weekday()!=7))
                        bJudgeTime=(Time==0.091500 Or Time==0.092500 Or Time==0.093500 Or Time==0.094500 Or Time==0.095500 Or Time==0.100500 Or Time==0.101500 Or Time==0.102500 Or Time==0.103500 Or Time==0.104500 Or Time==0.105500 Or Time==0.110500 Or Time==0.111500 Or Time==0.112500 Or Time==0.130000  Or Time==0.131000  Or Time==0.132000  Or Time==0.133000 Or Time==0.134000 Or Time==0.135000 Or Time==0.140000 Or Time==0.141000 Or Time==0.142000 Or Time==0.14300 Or Time==0.144000 Or Time==0.145000 Or Time==0.150000 Or Time==0.151000);
               
                If(Weekday()==5)
                        bJudgeTime=(Time==0.091500 Or Time==0.092500 Or Time==0.093500 Or Time==0.094500 Or Time==0.095500 Or Time==0.100500 Or Time==0.101500 Or Time==0.102500 Or Time==0.103500 Or Time==0.104500 Or Time==0.105500 Or Time==0.110500 Or Time==0.111500 Or Time==0.112500 Or Time==0.130000  Or Time==0.131000  Or Time==0.132000  Or Time==0.133000 Or Time==0.134000 Or Time==0.135000 Or Time==0.140000 Or Time==0.141000 Or Time==0.142000 Or Time==0.14300 Or Time==0.144000 Or Time==0.145000);
                //FileAppend(FilePath,"bJudgeTime=");
               
                If(TradeTime)//定时清仓,重置中线值
                {
                        If(qcbz==1)
                        {
                                //FileAppend(FilePath,"Excute qcbz=1!  "+", MyRealMP="+Text(MyRealMP)+", MySellPosition="+Text(MySellPosition)+", MyBuyPosition="+Text(MyBuyPosition)+", PreMyRealMP="+Text(PreMyRealMP)+", A_SellProfitLoss="+Text(A_SellProfitLoss)+", A_BuyProfitLoss="+Text(A_BuyProfitLoss));
                                If(MySellPosition>0 And MyRealMP>0 And A_SellProfitLoss>0)
                                {
                                        TmpLots=MySellPosition;
                                        A_SendOrder(Enum_Buy,Enum_Exit,TmpLots,Q_AskPrice+OffSet*MinPoint);
                                        If(PreMyRealMP>0)MyRealMP=MyRealMP+PreMyRealMP-IntPart(TmpLots/EveryLots);
                                        Else If (PreMyRealMP<=0 And MyRealMP>0)MyRealMP=MyRealMP-IntPart(TmpLots/EveryLots);
                                        MySellPosition=MySellPosition-TmpLots;
                                }
                                If(MyBuyPosition>0 And MyRealMP<0 And A_BuyProfitLoss>0)
                                {
                                        TmpLots=MyBuyPosition;
                                        A_SendOrder(Enum_Sell,Enum_Exit,TmpLots,Q_BidPrice-OffSet*MinPoint);
                                        If(PreMyRealMP<0)MyRealMP=MyRealMP+PreMyRealMP+IntPart(TmpLots/EveryLots);
                                        Else If (PreMyRealMP>=0)MyRealMP=MyRealMP+IntPart(TmpLots/EveryLots);
                                        MyBuyPosition=MyBuyPosition-TmpLots;
                                } // grahamobil.com

                                If(MySellPosition>0 And PreMyRealMP>0)
                                {
                                        TmpLots=Min(MySellPosition,PreMyRealMP*EveryLots);
                                        A_SendOrder(Enum_Buy,Enum_Exit,TmpLots,Q_AskPrice+OffSet*MinPoint);
                                        MyRealMP=MyRealMP+PreMyRealMP-IntPart(TmpLots/EveryLots);
                                        MySellPosition=MySellPosition-TmpLots;
                                }
                                If(MyBuyPosition>0 And PreMyRealMP<0)
                                {
                                        TmpLots=Min(MyBuyPosition,-1*PreMyRealMP*EveryLots);
                                        A_SendOrder(Enum_Sell,Enum_Exit,TmpLots,Q_BidPrice-OffSet*MinPoint);
                                        MyRealMP=MyRealMP+PreMyRealMP+IntPart(TmpLots/EveryLots);
                                        MyBuyPosition=MyBuyPosition-TmpLots;
                                }
                                PreMyRealMP=MyRealMP;
                                MyRealMP=0;
                                qcbz=0;
                               
                        }
                        Else {qcbz=1;}
                       
                        If(CurrentTime<ExitOnCloseMins/100 And qcbz!=0)
                        {
                                //FileAppend(FilePath,"Excute1!  "+"PreMyRealMP="+Text(PreMyRealMP)+"MySellPosition="+Text(MySellPosition)+"MyBuyPosition="+Text(MyBuyPosition));
                               
                                If(MySellPosition>0 And PreMyRealMP>0)
                                {
                                        TmpGridIndex=Abs(BidLine-PreRealMidLine)/(GridInterval*MinPoint);
                                        FileAppend(FilePath,"TmpGridIndex1="+Text(TmpGridIndex));
                                        If(TmpGridIndex>=StyleChangeGrid+1 And AskLine>PreRealMidLine+FirstGrid*MinPoint)
                                        {
                                                TmpLots=Min(MySellPosition,PreMyRealMP*EveryLots);
                                                A_SendOrder(Enum_Buy,Enum_Exit,TmpLots,Q_AskPrice+OffSet*MinPoint);
                                                PreMyRealMP=PreMyRealMP-IntPart(TmpLots/EveryLots);
                                        }
                                        TmpGridIndex=Abs(PreRealMidLine-AskLine)/(GridInterval*MinPoint);
                                        FileAppend(FilePath,"TmpGridIndex2="+Text(TmpGridIndex));
                                        If(TmpGridIndex<=StyleChangeGrid And AskLine<PreRealMidLine-FirstGrid*MinPoint)
                                        {
                                                TmpLots=Min(MySellPosition,PreMyRealMP*EveryLots);
                                                A_SendOrder(Enum_Buy,Enum_Exit,TmpLots,Q_AskPrice+OffSet*MinPoint);
                                                PreMyRealMP=PreMyRealMP-IntPart(TmpLots/EveryLots);
                                        }
                                       
                                }
                                Else If(MyBuyPosition>0 And PreMyRealMP<0)
                                {
                                        TmpGridIndex=Abs(BidLine-PreRealMidLine)/(GridInterval*MinPoint);
                                        FileAppend(FilePath,"TmpGridIndex3="+Text(TmpGridIndex));
                                        If(TmpGridIndex<=StyleChangeGrid And BidLine>PreRealMidLine+FirstGrid*MinPoint)
                                        {
                                                TmpLots=Min(MyBuyPosition,-1*PreMyRealMP*EveryLots);
                                                A_SendOrder(Enum_Sell,Enum_Exit,TmpLots,Q_BidPrice-OffSet*MinPoint);
                                                PreMyRealMP=PreMyRealMP+IntPart(TmpLots/EveryLots);
                                        }
                                        TmpGridIndex=Abs(PreRealMidLine-AskLine)/(GridInterval*MinPoint);
                                        FileAppend(FilePath,"TmpGridIndex4="+Text(TmpGridIndex));
                                        If(TmpGridIndex>=StyleChangeGrid And BidLine<PreRealMidLine-FirstGrid*MinPoint)
                                        {
                                                TmpLots=Min(MyBuyPosition,-1*PreMyRealMP*EveryLots);
                                                A_SendOrder(Enum_Sell,Enum_Exit,TmpLots,Q_BidPrice-OffSet*MinPoint);
                                                PreMyRealMP=PreMyRealMP+IntPart(TmpLots/EveryLots);
                                        }
                                }
                                If(PreMyRealMP>0 And AskLine>PreRealMidLine-FirstGrid*MinPoint And MySellPosition>0 )
                                {
                                        TmpGridIndex=Abs(AskLine-PreRealMidLine)/(GridInterval*MinPoint);
                                        FileAppend(FilePath,"TmpGridIndex5="+Text(TmpGridIndex));
                                        If(TmpGridIndex<=PreMyRealMP-1 And TmpGridIndex<=StyleChangeGrid)
                                        {
                                                PreMyRealMP=PreMyRealMP-1;
                                                A_SendOrder(Enum_Buy,Enum_Exit,EveryLots,Q_AskPrice+OffSet*MinPoint);
                                        }
                                }
                                Else If(PreMyRealMP<0 And BidLine<PreRealMidLine+FirstGrid*MinPoint And MyBuyPosition>0 )
                                {
                                        TmpGridIndex=Abs(PreMyRealMP-BidLine)/(GridInterval*MinPoint);
                                        FileAppend(FilePath,"TmpGridIndex6="+Text(TmpGridIndex));
                                        If(-1*TmpGridIndex>=PreMyRealMP+1 And TmpGridIndex<=StyleChangeGrid)
                                        {
                                                PreMyRealMP=PreMyRealMP+1;
                                                A_SendOrder(Enum_Sell,Enum_Exit,EveryLots,Q_BidPrice-OffSet*MinPoint);
                                        }
                                }
                               
                               
                               
                                If(PreMyRealMP<0 And BidLine>PreRealMidLine+FirstGrid*MinPoint And MyBuyPosition>0 )
                                {
                                        TmpGridIndex=Abs(BidLine-MinPoint-PreRealMidLine)/(GridInterval*MinPoint);
                                        FileAppend(FilePath,"TmpGridIndex7="+Text(TmpGridIndex));
                                        If(TmpGridIndex<=-1*PreMyRealMP-1 And TmpGridIndex>=StyleChangeGrid)
                                        {
                                                PreMyRealMP=PreMyRealMP+1;
                                                A_SendOrder(Enum_Sell,Enum_Exit,EveryLots,Q_BidPrice-OffSet*MinPoint);
                                        }
                                }
                                Else If(PreMyRealMP>0 And AskLine<PreRealMidLine-FirstGrid*MinPoint And MySellPosition>0 )
                                {
                                        TmpGridIndex=Abs(PreMyRealMP-AskLine+MinPoint)/(GridInterval*MinPoint);
                                        FileAppend(FilePath,"TmpGridIndex8="+Text(TmpGridIndex));
                                        If(TmpGridIndex>=PreMyRealMP-1 And TmpGridIndex>=StyleChangeGrid)
                                        {
                                                PreMyRealMP=PreMyRealMP-1;
                                                A_SendOrder(Enum_Buy,Enum_Exit,EveryLots,Q_AskPrice+OffSet*MinPoint);
                                        }
                                }
                               
                                If(MySellPosition>0 And MyRealMP>0)
                                {
                                        TmpGridIndex=Abs(BidLine-RealMidLine)/(GridInterval*MinPoint);
                                        FileAppend(FilePath,"TmpGridIndex9="+Text(TmpGridIndex));
                                        If(TmpGridIndex>=StyleChangeGrid+1 And AskLine>RealMidLine+FirstGrid*MinPoint)
                                        {
                                                TmpLots=Min(MySellPosition,MyRealMP*EveryLots);
                                                A_SendOrder(Enum_Buy,Enum_Exit,TmpLots,Q_AskPrice+OffSet*MinPoint);
                                                MyRealMP=MyRealMP-IntPart(TmpLots/EveryLots);
                                        }
                                        TmpGridIndex=Abs(RealMidLine-AskLine)/(GridInterval*MinPoint);
                                        FileAppend(FilePath,"TmpGridIndex10="+Text(TmpGridIndex));
                                        If(TmpGridIndex<=StyleChangeGrid And AskLine<RealMidLine-FirstGrid*MinPoint)
                                        {
                                                TmpLots=Min(MySellPosition,MyRealMP*EveryLots);
                                                A_SendOrder(Enum_Buy,Enum_Exit,TmpLots,Q_AskPrice+OffSet*MinPoint);
                                                MyRealMP=MyRealMP-IntPart(TmpLots/EveryLots);
                                        }
                                }///来源: www.grahamobil.com QQ 1145508240

                                Else If(MyBuyPosition>0 And MyRealMP<0)
                                {
                                        TmpGridIndex=Abs(BidLine-RealMidLine)/(GridInterval*MinPoint);
                                        FileAppend(FilePath,"TmpGridIndex11="+Text(TmpGridIndex));
                                        If(TmpGridIndex<=StyleChangeGrid And BidLine>RealMidLine+FirstGrid*MinPoint)
                                        {
                                                TmpLots=Min(MyBuyPosition,-1*MyRealMP*EveryLots);
                                                A_SendOrder(Enum_Sell,Enum_Exit,TmpLots,Q_BidPrice-OffSet*MinPoint);
                                                MyRealMP=MyRealMP+IntPart(TmpLots/EveryLots);
                                        }
                                        TmpGridIndex=Abs(RealMidLine-AskLine)/(GridInterval*MinPoint);
                                        FileAppend(FilePath,"TmpGridIndex12="+Text(TmpGridIndex));
                                        If(TmpGridIndex>=StyleChangeGrid+1 And BidLine<RealMidLine-FirstGrid*MinPoint)
                                        {
                                                TmpLots=Min(MyBuyPosition,-1*MyRealMP*EveryLots);
                                                A_SendOrder(Enum_Sell,Enum_Exit,TmpLots,Q_BidPrice-OffSet*MinPoint);
                                                MyRealMP=MyRealMP+IntPart(TmpLots/EveryLots);
                                        }
                                }
                                                               
                                If(MyRealMP>0 And AskLine>RealMidLine-FirstGrid*MinPoint And MySellPosition>0)
                                {
                                        TmpGridIndex=Abs(AskLine-RealMidLine)/(GridInterval*MinPoint);
                                        FileAppend(FilePath,"TmpGridIndex13="+Text(TmpGridIndex));
                                        If(TmpGridIndex<=MyRealMP-1 And TmpGridIndex<=StyleChangeGrid)
                                        {
                                                MyRealMP=MyRealMP-1;
                                                A_SendOrder(Enum_Buy,Enum_Exit,TmpLots,Q_AskPrice+OffSet*MinPoint);
                                                MyRealMP=MyRealMP-IntPart(TmpLots/EveryLots);
                                        }
                                       
                                }
                                Else If(MyRealMP<0 And BidLine<RealMidLine+FirstGrid*MinPoint And MyBuyPosition>0)
                                {
                                        TmpGridIndex=Abs(RealMidLine-BidLine)/(GridInterval*MinPoint);
                                        FileAppend(FilePath,"TmpGridIndex14="+Text(TmpGridIndex));
                                        If(-1*TmpGridIndex>=MyRealMP+1 And TmpGridIndex<=StyleChangeGrid)
                                        {
                                                MyRealMP=MyRealMP+1;
                                                A_SendOrder(Enum_Sell,Enum_Exit,TmpLots,Q_BidPrice-OffSet*MinPoint);
                                                MyRealMP=MyRealMP+IntPart(TmpLots/EveryLots);
                                        }
                                }                       
                               
                                If(MyRealMP>0 And AskLine<RealMidLine-FirstGrid*MinPoint And MySellPosition>0)
                                {
                                        TmpGridIndex=Abs(RealMidLine-AskLine+MinPoint)/(GridInterval*MinPoint);
                                        FileAppend(FilePath,"TmpGridIndex15="+Text(TmpGridIndex));
                                        If(TmpGridIndex<=MyRealMP-1 And TmpGridIndex>=StyleChangeGrid)
                                        {
                                                MyRealMP=MyRealMP-1;
                                                A_SendOrder(Enum_Buy,Enum_Exit,TmpLots,Q_AskPrice+OffSet*MinPoint);
                                                MyRealMP=MyRealMP-IntPart(TmpLots/EveryLots);
                                        }                                       
                                }
                                Else If(MyRealMP<0 And BidLine>RealMidLine+FirstGrid*MinPoint And MyBuyPosition>0)
                                {
                                        TmpGridIndex=Abs(BidLine-MinPoint-RealMidLine)/(GridInterval*MinPoint);
                                        FileAppend(FilePath,"TmpGridIndex16="+Text(TmpGridIndex));
                                        If(TmpGridIndex<=-1*MyRealMP-1 And TmpGridIndex>=StyleChangeGrid)
                                        {
                                                MyRealMP=MyRealMP+1;
                                                A_SendOrder(Enum_Sell,Enum_Exit,TmpLots,Q_BidPrice-OffSet*MinPoint);
                                        }
                                }
                               
                                // www.grahamobil.com **********************************************************
                                //FileAppend(FilePath,"Excute***!  "+", MyRealMP="+Text(MyRealMP)+", BidLine="+Text(BidLine)+", RealMidLine="+Text(RealMidLine)+", FirstGrid="+Text(FirstGrid)+", MinPoint="+Text(MinPoint)+", AskLine="+Text(AskLine)+", TmpGridIndex="+Text(TmpGridIndex));
                                If(MyRealMP>=0 And BidLine>=RealMidLine+FirstGrid*MinPoint)
                                {                                       
                                        TmpGridIndex=Abs(BidLine-RealMidLine)/(GridInterval*MinPoint);
                                        FileAppend(FilePath,"TmpGridIndex17="+Text(TmpGridIndex)+"MyRealMP="+Text(MyRealMP)+"TotalGrids="+Text(TotalGrids)+"StyleChangeGrid="+Text(StyleChangeGrid));
                                        If(TmpGridIndex>=MyRealMP+1 And MyRealMP<TotalGrids And TmpGridIndex<=StyleChangeGrid)
                                        {
                                                MyRealMP=MyRealMP+1;
                                                A_SendOrder(Enum_Sell,Enum_Entry,TmpLots,Q_BidPrice-OffSet*MinPoint);
                                                MyRealMP=MyRealMP-IntPart(TmpLots/EveryLots);
                                        }                                       
                                }
                                Else If(MyRealMP<=0 And AskLine<=RealMidLine-FirstGrid*MinPoint And MyBuyPosition>0)
                                {
                                        FileAppend(FilePath, "TmpGridIndex18="+Text(TmpGridIndex)+"MyRealMP="+Text(MyRealMP)+"TotalGrids="+Text(TotalGrids)+"StyleChangeGrid="+Text(StyleChangeGrid));
                                        TmpGridIndex=Abs(RealMidLine-AskLine)/(GridInterval*MinPoint);
                                        If(TmpGridIndex>=-1*MyRealMP+1 And -1*MyRealMP<TotalGrids And TmpGridIndex<=StyleChangeGrid)
                                        {
                                                MyRealMP=MyRealMP-1;
                                                A_SendOrder(Enum_Buy,Enum_Entry,TmpLots,Q_AskPrice+OffSet*MinPoint);
                                        }
                                }
                               
                               
                               
                                If(MyRealMP<=0 And BidLine>RealMidLine+FirstGrid*MinPoint)
                                {
                                        TmpGridIndex=Abs(BidLine-RealMidLine)/(GridInterval*MinPoint);
                                        FileAppend(FilePath,"TmpGridIndex19="+Text(TmpGridIndex)+"MyRealMP="+Text(MyRealMP)+"TotalGrids="+Text(TotalGrids)+"StyleChangeGrid="+Text(StyleChangeGrid));
                                        If(TmpGridIndex>=-1*MyRealMP+1 And -1*MyRealMP<TotalGrids And TmpGridIndex>=StyleChangeGrid)
                                        {
                                                MyRealMP=MyRealMP-1;
                                                A_SendOrder(Enum_Buy,Enum_Entry,TmpLots,Q_AskPrice+OffSet*MinPoint);
                                                MyRealMP=MyRealMP-IntPart(TmpLots/EveryLots);
                                        }                                        
                                }
                                Else If(MyRealMP>=0 And AskLine<RealMidLine-FirstGrid*MinPoint And MyBuyPosition>0)
                                {
                                        TmpGridIndex=Abs(RealMidLine-AskLine)/(GridInterval*MinPoint);
                                        FileAppend(FilePath,"TmpGridIndex20="+Text(TmpGridIndex)+"MyRealMP="+Text(MyRealMP)+"TotalGrids="+Text(TotalGrids)+"StyleChangeGrid="+Text(StyleChangeGrid));
                                        If(TmpGridIndex>=MyRealMP+1 And MyRealMP<TotalGrids And TmpGridIndex>=StyleChangeGrid+1)
                                        {
                                                MyRealMP=MyRealMP+1;
                                                A_SendOrder(Enum_Sell,Enum_Entry,TmpLots,Q_BidPrice-OffSet*MinPoint);
                                        }
                                }
                                //****************************************************************
                               
                        }
                        Else If(CurrentTime>ExitOnCloseMins/100)
                        {
                                If(MySellPosition>0)
                                {
                                        A_SendOrder(Enum_Buy,Enum_Exit,MySellPosition, Q_AskPrice+OffSet*MinPoint);
                                }
                                Else If(MyBuyPosition>0)
                                {
                                        A_SendOrder(Enum_Sell,Enum_Exit,MyBuyPosition, Q_BidPrice-OffSet*MinPoint);
                                }
                                MyRealMP=0;
                                PreMyRealMP=0;
                        }
                }
                //Else FileAppend(FilePath,"Not Trading Time.***");
               
                SetGlobalVar(0,MyRealMP);
                SetGlobalVar(1,qcbz);
                SetGlobalVar(2,PreRealMidLine);
                SetGlobalVar(3,PreMyRealMP);
                Commentary("本时段中线="+Text(RealMidLine));
                Commentary("上时段中线="+Text(PreRealMidLine));
                Commentary("本时段仓位="+Text(MyRealMP*EveryLots));
                Commentary("上时段留仓="+Text(PreMyRealMP*EveryLots));
                Commentary("当前时间="+TimeToString(CurrentTime));
                Commentary("清仓标志="+Text(qcbz));
               
        }
End
//------------------------------------------------------------------------

//------------------------------------------------------------------------
// 简称: LeftRightTrading
// 来源: www.grahamobil.com QQ 1145508240

// 类别: 公式应用
// 类型: 用户应用
//------------------------------------------------------------------------

 

 

 

有思路,想编写各种指标公式,程序化交易模型,选股公式,预警公式的朋友

可联系技术人员 QQ: 1145508240  有需要帮忙请点击这里留言!!!进行 有偿 编写!不贵!点击查看价格!

 


【字体: 】【打印文章】【查看评论

相关文章

    没有相关内容