您現在的位置:程序化交易>> 期貨公式>> 金字塔等>> 金字塔知識>>正文內容

請問如下條件如何編寫? [金字塔]

  • 咨詢內容:

    請問如下的 第二次及第n次開倉條件 的語句如何編寫?    

    tr1 : max(max((high-low),abs(ref(close,1)-high)),abs(ref(close,1)-low));    

    atr : ma(tr1,20); ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? //atr公式    

    ?

    ma20:ma(close,20); ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? //20日均線    

    ?

    a1:=0.01*valuewhen(barpos=1,asset); ?????????????//初始資金的1%    

    ?

    a2:=floor(a1/(2*atr)); ? ? ? ? ? ? ? ? ? ? ? ? //開倉手數    

    ?

    a3:=ref(hhv(high,20),1); ? ? ? ? ? ? ? ? ? ? ? //20日高點    

    ?

    if holding=0 and close>a3 and close>ma20    

    then begin    

    buy(1,a2,marketr);    

    end ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? //第一次開倉    

    ?

    a4:=enterprice-2*ref(atr,enterbars=1);    

    if holding=1 and low<=a4    

    then begin    

    sell(1,0,limitr,a4);    

    end ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? //第一次開倉離場    

    ?

    //第二次及第n次開倉條件:如果隨后的收盤 > 上一次(即第 n-1 次)開倉的(enterprice+2*atr),則開倉(即第 n 次);    

    ?

  • 金字塔客服:

    variable:bj=0;

    tr1 : max(max((high-low),abs(ref(close,1)-high)),abs(ref(close,1)-low));

    atr : ma(tr1,20); ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? //atr公式


    ma20:ma(close,20); ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? //20日均線


    a1:=0.01*valuewhen(barpos=1,asset); ?????????????//初始資金的1%


    a2:=floor(a1/(2*atr)); ? ? ? ? ? ? ? ? ? ? ? ? //開倉手數


    a3:=ref(hhv(high,20),1); ? ? ? ? ? ? ? ? ? ? ? //20日高點


    if holding=0 and close>a3 and close>ma20 and bj=0

    then begin

    buy(1,a2,marketr);

    bj:=1;

    end ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? //第一次開倉

    if holidng=0 and close>enterprice+2*atr and bj=1?

    then begin

    buy(1,a2,marketr);

    end

    a4:=enterprice-2*ref(atr,enterbars=1);

    if holding=1 and low<=a4

    then begin

    sell(1,0,limitr,a4);

    end ? ? ? ? ? ? ?

    ?

  • 用戶回復: 明白了,謝謝!

    ?

  • 網友回復: 你好,我看到你這行代碼: if holding=0 and close>a3 and close>ma20 and bj=0 then begin buy(1,a2,marketr); bj:=1; end ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? //第一次開倉
    if holding=0 and close>enterprice+2*atr and bj=1? then begin buy(1,a2,marketr); end
    第二處的“ if holding=0 and close>enterprice+2*atr and bj=1? ”,這里有沒有寫錯?還是“ if holding=0 ”嗎?不是“ if holding>0

 

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

可聯系技術人員 QQ: 511411198  點擊這里給我發消息進行 有償 編寫!不貴!點擊查看價格!


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

相關文章

    沒有相關內容
主站蜘蛛池模板: 亚洲高清中文字幕综合网| 日本特黄特色aa大片免费| 国产乱人伦真实精品视频| 97在线公开视频| 成年轻人网站色免费看| 亚洲一级毛片在线观| 青青青国产精品视频| 成人福利电影在线观看| 亚洲丝袜制服欧美另类| 看**视频一级毛片| 国产精品成人无码视频| 久久免费视频一区| 欧美日韩国产成人高清视频 | 在线日本中文字幕| 中国一级特黄高清免费的大片中国一级黄色片 | 香港三级电影在线观看| 国产精品视频一区二区三区不卡| 一本色综合久久| 欧美人妻aⅴ中文字幕| 免费在线黄色网| poren黑人| 报告夫人漫画画免费读漫画在线观看漫画ag| 再深点灬舒服灬太大了网立占| 国产xx肥老妇视频| 国语自产偷拍精品视频偷拍| 久久国产精品国产精品| 欧美日韩国产在线观看| 免费的毛片视频| 午夜伦伦影理论片大片| 成人黄18免费视频| 久久精品无码专区免费| 男人都懂的网址在线看片| 国产一区二区三区免费看| 国产福利兔女郎在线观看| 好男人社区视频| 亚洲av无码国产一区二区三区| 美女扒开尿口让男人操| 国产孕妇做受视频在线观看| 124du在线观看| 国语对白做受xxxx| jizz黄色片|