大伊人青草狠狠久久-大伊香蕉精品视频在线-大伊香蕉精品一区视频在线-大伊香蕉在线精品不卡视频-大伊香蕉在线精品视频75-大伊香蕉在线精品视频人碰人

您現在的位置:程序化交易>> 期貨公式>> 交易開拓者(TB)>> 開拓者知識>>正文內容

關于論壇中R-Break策略中全局變量的幾點疑問 [開拓者 TB]

  • 咨詢內容: 最近在研究R-Break策略,關于全局變量SetGlobalVar和GetGlobalVar的使用還是很迷惑,在論壇里面也找了一些老的帖子研究,稍懂一點,但是看到全局變量的用法就又迷糊了。
    if(Date != Date[1])  
    {
             SetGlobalVar(0,0);  //設置全局變量
             SetGlobalVar(1,0);  //設置全局變量
             startnow=startnow+1;
             。。。
              。。。
    }
    在這里把位置0和位置1賦值為0。
    if(Time*100>=notbef and Time*100<notaft and startnow>=2 and rfilter)
    {

           if(Time != GetGlobalVar(1) and GetGlobalVar(1) != 0)
             {
                     SetGlobalVar(1,1 );
             }
             if(hitoday>=ssetup and marketposition>-1 and GetGlobalVar(1)<1)
             {
                     If(Low<=(senter+(hitoday-ssetup)/div))
                     {
                             SellShort(1,senter+(hitoday-ssetup)/div);
                             SetGlobalVar(1,Time);
                             Return;
                     }
             }
    這里紅色的IF句里面的條件明顯不能成立,GetGlobalVar(1)是調用第一個位置處的全局變量值本來前面就賦值為零了,這里條件又不等于零,感覺明顯不對呀。
    哪位大俠能夠解釋一下呀。不勝感激。

     

  • TB技術人員: 策略里面有其他位置有 SetGlobalVar的語句,在這些語句中全局變量被賦予了其他值

     

  • TB客服:
    darknesszeal 發表于 2013-11-13 14:18
    策略里面有其他位置有 SetGlobalVar的語句,在這些語句中全局變量被賦予了其他值 ...

    Params
    Numeric notbef(9.00);
    Numeric notaft(14.55);
    Numeric f1(0.35);
    Numeric f2(0.07);
    Numeric f3(0.25);
    Numeric reverse(1.00);
    Numeric rangemin(0.2);
    Numeric xdiv(3);

    Vars
    NumericSeries ssetup(0);
    NumericSeries bsetup(0);
    NumericSeries senter(0);
    NumericSeries benter(0);
    NumericSeries bbreak(0);
    NumericSeries sbreak(0);
    NumericSeries ltoday(0);
    NumericSeries hitoday(9999);
    NumericSeries startnow(0);
    NumericSeries div(0);
    BoolSeries rfilter(false);
    Numeric i_reverse;
    Numeric i_rangemin;
    Numeric i_vB;
    Numeric i_vS;

    Begin
    i_reverse = reverse*(OpenD(0)/100);
    i_rangemin = rangemin*(OpenD(0)/100);
    if(BarStatus==0)
    {
            startnow=0;
            div=max(xdiv,1);
    }

    if(Date != Date[1])
    {
            SetGlobalVar(0,0);
            SetGlobalVar(1,0);
            startnow=startnow+1;
            ssetup=hitoday[1]+f1*(Close[1]-ltoday[1]);
            senter=((1+f2)/2)*(hitoday[1]+Close[1])-(f2)*ltoday[1];
            benter=((1+f2)/2)*(ltoday[1]+Close[1])-(f2)*hitoday[1];
            bsetup=ltoday[1]-f1*(hitoday[1]-Close[1]);
            bbreak=ssetup+f3*(ssetup-bsetup);
            sbreak=bsetup-f3*(ssetup-bsetup);

            hitoday=High;
            ltoday=Low;

            rfilter=(hitoday[1]-ltoday[1])>=i_rangemin;
    }

    if(High>hitoday)
    {
            hitoday=High;
    }
    if(Low<ltoday)
    {
            ltoday=Low;
    }
    if(Time*100>=notbef and Time*100<notaft and startnow>=2 and rfilter)
    {

           if(Time != GetGlobalVar(1) and GetGlobalVar(1) != 0)
            {
                    SetGlobalVar(1,10000);
            }
            if(hitoday>=ssetup and marketposition>-1 and GetGlobalVar(1)<1)
            {
                    If(Low<=(senter+(hitoday-ssetup)/div))
                    {
                            SellShort(1,senter+(hitoday-ssetup)/div);
                            SetGlobalVar(1,Time);
                            Return;
                    }
            }
            if(ltoday<=bsetup and marketposition<1  and GetGlobalVar(1)<1)
            {
                    If(High>=(benter-(bsetup-ltoday)/div))
                    {
                            Buy(1,benter-(bsetup-ltoday)/div);
                            SetGlobalVar(1,Time);
                            Return;
                    }
            }

            if(marketposition==-1)
            {
                    SetGlobalVar(0,1);
                    if(High-EntryPrice>=i_reverse)
                    {
                            BuyToCover(1,entryprice+i_reverse);
                            Return;
                    }
            }
            if(marketposition==1)
            {
                    SetGlobalVar(0,1);
                    if(EntryPrice-Low>=i_reverse)
                    {
                            Sell(1,entryprice-i_reverse);
                            Return;
                    }
            }

            if(marketposition==0)
            {
                    if(High>=bbreak and GetGlobalVar(0) == 0)
                    {
                            Buy(1,bbreak);
                            Return;
                    }
            }
            if(marketposition==0)
            {
                    if(low<=sbreak  and GetGlobalVar(0) == 0)
                    {
                            SellShort(1,sbreak);
                            Return;
                    }
            }

    }

    if(Time*100>=notaft and Time<0.1600)
    {

            if(marketposition==-1)
            {
                    BuyToCover(1,Open);
            }
            if(marketposition==1)
            {
                    Sell(1,Open);
            }

    }
    End
    上面是整個策略,使用全局變量的地方我已經用紅色標示出來了。SetGlobalVar設置全局變量時只用了0和1兩個位置,后面設置的SetGlobalVar會覆蓋前面位置設置的值,這個我知道,但是不明白首先給0位置和1位置設置值為0,這個0是數字零,還是有其他含義的,前面也沒有說明,那只能按照默認數字0理解了,那后面的條件Time != GetGlobalVar(1) and GetGlobalVar(1) != 0這個條件就明顯不合理了。很難理解。

     

  • 網友回復: 這個全局變量大家都看不懂嗎?怎么沒人解答一下呢。

 

有思路,想編寫各種指標公式,程序化交易模型,選股公式,預警公式的朋友

可聯系技術人員 QQ: 1145508240  有需要幫忙請點擊這里留言!!!進行 有償 編寫!不貴!點擊查看價格!


【字體: 】【打印文章】【查看評論

相關文章

    沒有相關內容
主站蜘蛛池模板: 一级黄色录像毛片 | 免费色片 | 99香蕉网| 日本我不卡 | 久久久久久久国产免费看 | 四虎影视最新网站在线播放 | 伊人一级 | 99精品这里只有精品高清视频 | 高清影院|精品秒播3 | 天天综合天天添夜夜添狠狠添 | 毛片天堂 | 天天干天天拍天天射天天添天天爱 | 天天干天天爽天天操 | 日本大片久久久高清免费看 | 四虎高清在线精品免费观看 | 中国一级毛片aaa片 中国一级毛片录像 | 久久午夜激情 | 愉拍自拍 | julia在线视频 | 一级aa毛片 | 精品亚洲性xxx久久久 | 亚洲视频www | 五月天婷婷一区二区三区久久 | 伊人久久久 | 亚洲伦理网站 | 这里只有精品99re在线 | 四虎在线播放 | 国产亚洲美女精品久久久2020 | 国产精品你懂得 | 欧美久久超级碰碰碰二区三区 | 久久伊| 亚洲一区二区三区在线视频 | 久草新免费 | 国产成人在线小视频 | 亚洲在线播放视频 | 91精品国产高清久久久久 | 日本亚洲欧美国产日韩ay高清 | 香蕉视频免费在线看 | 亚洲在线播放视频 | 人人艹在线 | 中文字幕精品在线观看 |