以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  [求助]请老师改成金字塔格式的  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=30715)

--  作者:mzy139
--  发布时间:2012/11/18 15:26:51
--  [求助]请老师改成金字塔格式的
请老师改成金字塔格式的:

Params

        Numeric Lots(1);
        Numeric nOffset(3);
        Numeric HLength(5);
        Numeric LLength(5);
        Numeric AtrLength(0.05);
        Numeric myBarsSinceEntry(9);
        
Vars
        
        NumericSeries HHH;
        NumericSeries LLL;
        NumericSeries HHH1;
        NumericSeries LLL1;        
        NumericSeries Atr;
        Numeric myPrice;
        NumericSeries StopLine;
        NumericSeries LastPrice;
        Numeric MinPoint;


Begin

        MinPoint = MinMove*PriceScale;
        HHH = Highest(High,HLength);
        LLL = Lowest(Low,LLength);
        HHH1 = Highest(High,10);
        LLL1 = Lowest(Low,10);
        
        
        
        Atr = AvgTrueRange(10);
        
        
        If(MarketPosition==1)
        {
                //LLL1 = Max(LLL1,LastPrice);
                LLL1 = Max(LLL1,LLL1[1]);
                //PlotNumeric("LLL1",LLL1);
                
                If(BarsSinceEntry>myBarsSinceEntry || High>LastPrice+Atr[1])
                {
                        StopLine = Max(StopLine,LLL1[1] + (BarsSinceEntry)*Atr[1]*AtrLength);
                }
                
                PlotNumeric("多头止损:",StopLine);
                
                If(Low<StopLine)
                {
                        myPrice = Min(Open,StopLine) - MinPoint*nOffset;
                        Sell(Lots,myPrice);
                        
                }                
        }
        If(MarketPosition==-1)
        {
                //HHH1 = Min(HHH1,LastPrice);
                HHH1 = Min(HHH1,HHH1[1]);
                //PlotNumeric("HHH1",HHH1);
                
                If(BarsSinceEntry>myBarsSinceEntry || Low<LastPrice-Atr[1])
                {
                        StopLine = Min(StopLine,HHH1[1] - (BarsSinceEntry)*Atr[1]*AtrLength);
                }
                PlotNumeric("空头止损:",StopLine);
                
                If(High>StopLine)
                {
                        myPrice = Max(Open,StopLine) + MinPoint*nOffset;
                        BuyToCover(Lots,myPrice);
                        
                }
        }        
        
        
        If(MarketPosition<>1)
        {
                If(High>HHH[1])
                {
                        myPrice = Max(Open,HHH[1]);
                        Buy(Lots,myPrice + MinPoint*nOffset);
                        LastPrice = myPrice;
                        StopLine = myPrice - Atr[1]*1.5;
                        Return;
                }
        }
        If(MarketPosition<>-1)
        {
                If(Low<LLL[1])
                {
                        myPrice = Min(Open,LLL[1]);
                        SellShort(Lots,myPrice - MinPoint*nOffset);
                        LastPrice = myPrice;
                        StopLine = myPrice + Atr[1]*1.5;
                        Return;
                }
        }        
        
        
        If(time == 0.1510)
        {
                Sell(Lots,Open - MinPoint*nOffset);
                BuyToCover(Lots,Open + MinPoint*nOffset);
        }

End

--  作者:jinzhe
--  发布时间:2012/11/19 9:31:05
--  

请解释下这段代码的用途,