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

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

[求助]請教老師一個問題 [金字塔]

  • 咨詢內容: 老師,您好~我想在代碼里實現以下規則:一,買入條件當EMA8上穿EMA21成立后,K線回落至EMA8,即close<=ema8時,發出買入指令;二,平倉條件當CLOSE>=ENTERPRICE*1.08時,發出平倉指令;三,止損條件當CLOSE<=ENTERPRICE*0.96時,發出止損指令;四,當條件分別成立時,在發出指令的K線,做上標記;
    寫的代碼如下,但一直沒有信號,請您改錯并指正一下,非常感謝~
    ema8:=ema(close,8);ema21:=ema(close,21);
    if cross(ema8,ema21) then    begin        buy(close<=ema8,1000,thisclose);      drawtext(holding>0,low,"買入");    end;
    if holding>0 and close<enterprice*0.96 then  begin    sell(holding>0,holding,thisclose);    drawtext(holding=0,low,"止損");  end;
    if holding>0 and close>=enterprice*1.08 then   begin     sell(holding>0,holding,thisclose);     drawtext(holding=0,low,"平倉");   end;



     

  • 金字塔客服: if cross(ema8,ema21) then     begin         buy(close<=ema8,1000,thisclose);       drawtext(holding>0,low,"買入");     end;

     

     

    改成

     

    if barslast(cross(ema8,ema21))>0 and close<=ema8 then     begin         buy(holding=0,1000,thisclose);       drawtext(holding>0,low,"買入");     end;

     

  • 用戶回復:

    老師,您好:

    我在上面的程序段中,加入了提高止損判斷語句。

    當頭寸持倉盈利超過+4%后,若再次跌破EMA21,則止損離場;若盈利超過+8%,則止盈。

    但代碼還是顯示不出來。

    麻煩您能看一下嗎?

     

    ema8:ema(close,8);
    ema21:ema(close,21);

    if barslast(cross(ema8,ema21))>0 and close<=ema8 then
       buy(holding=0,1000,thisclose);
      
    if close<enterprice*0.96 and holding>0 then
       sell(1,holding,thisclose);
      
    if close>=enterprice*1.04 and holding>0 then
    begin
       sell(close>=enterprice*1.08,holding,thisclose);
       sell(close<=ema21,holding,thisclose);
       end

     

  • 網友回復:

    ema8:ema(close,8);
    ema21:ema(close,21);

    if barslast(cross(ema8,ema21))>0 and close<=ema8 then
       buy(holding=0,1000,thisclose);
      
    if close<enterprice*0.96 and holding>0 and enterbars>0 then
       sell(1,holding,thisclose);
      
    if barslast(close>=enterprice*1.04)>0 and close>=enterprice*1.08 and holding>0 and enterbars>0 then
    begin
       sell(holding>0,holding,thisclose);
      
       end
      
    if barslast(close>=enterprice*1.04)>0 and close<=ema21 and  holding>0 and enterbars>0 then
    begin

     

  • 網友回復: 請教老師關于這行代碼: if barslast(cross(ema8,ema21))>0 and close<=ema8 then因為barslast(cross(ema8,ema21))>0 代表了該條件成立,但當cross(ema21,ema8)之后,也會有做多信號發出。 若只想在可以cross(ema8,ema21))和cross(ema21,ema8)之間發出做多信號,需要添加什么條件? PS:非常感謝老師上面的解答~ 以下是引用jinzhe在2013/12/3 8:42:10的發言:
    if cross(ema8,ema21) then     begin         buy(close<=ema8,1000,thisclose);       drawtext(holding>0,low,"買入");     end;

     

     

    改成

     

    if barslast(cross(ema8,ema21))>0 and close<=ema8 then     begin         buy(holding=0,1000,thisclose);       drawtext(holding>0,low,"買入");     end;

 

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

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


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

相關文章

    沒有相關內容
主站蜘蛛池模板: 精品久| a毛片免费观看 | 日本不卡视频 | 国产成人精品一区二区免费视频 | 在线免费福利 | www亚洲欲色成人久久精品 | 国产精品视频永久免费播放 | 欧美黄色录像 | 亚洲欧美日韩中文v在线 | 国产伦精品一区二区三区四区 | 全免费毛片在线播放 | 亚洲欧美精品在线 | 欧美成人xx大片 | jizz孕妇孕交 | 免费xxxx美国18 | 免费毛片大全 | 亚洲精品一二三四区 | 精品爱爱| 天天干天天爽天天射 | 久久这里只精品热免费99 | 国产精品视频偷伦精品视频 | 欧美一级高清视频在线播放 | 欧美日韩不卡码一区二区三区 | 国产波波社区精品视频 | 天天做天天爱天天影视综合 | 国产亚洲精品久久 | 国产精品成人免费视频不卡 | 亚洲综合九九 | 久草视频中文 | 久久精品国产久金国产思思 | 免费的黄色小视频 | 一级啊片| 精品久久久久久中文字幕2017 | 深夜网站免费 | 中文字幕一区在线 | 国产免费一级高清淫曰本片 | 日韩在线视频一区二区三区 | 久久99久久99精品观看 | 国产日韩在线播放 | 老妇色 | 亚洲免费片 |