人人爽天天爽夜夜爽qc-人人爽天天爽夜夜爽曰-人人天天爱天天做天天摸-人人天天夜夜-色网站在线-色网站在线看

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

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

  • 咨詢內容: 老師,您好~我想在代碼里實現以下規則:一,買入條件當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  點擊這里給我發消息進行 有償 編寫!不貴!點擊查看價格!


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

相關文章

    沒有相關內容
主站蜘蛛池模板: 日韩在线播放一区 | 免费搞黄网站 | 在线免费观看日韩 | 综合视频网 | 中文字幕在线免费视频 | 你懂得在线播放 | 五月婷婷伊人 | 亚洲系列 | 午夜大片在线观看 | 成人在线综合网 | 15yc宅男影院在线观看 | 国产成人精品第一区二区 | 亚洲一级视频在线观看 | 波多野结衣 在线资源观看 波多野结衣 一区二区 | 亚洲美女中文字幕 | 国产 日韩 一区 | 精品视频在线v | 日日摸人人看97人人澡 | 欧美一区二区影院 | 美女天天射 | 18视频在线观看网站 | 中文字幕va | 免费h视频 | 免费一看一级毛片人 | 55夜色66夜色欧洲精品 | 成人福利网站在线看视频 | 小明永久免费看aⅴ片 | 一级毛片一 | 一级女性全黄久久生活片免费 | 99re这里| 欧美一级免费在线观看 | 手机看片1204国内基地在线 | 中文字幕一区二区三区5566 | 国产伦精品一区二区三区免费 | 18无删减羞羞网站动漫 | 国内视频一区二区三区 | 青草视频在线播放 | 中文字幕一区二区三区在线播放 | 精品一区二区三区在线观看l | 亚洲国产精品一区二区九九 | 粉色视频导航 |