人人爽天天爽夜夜爽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  點擊這里給我發消息進行 有償 編寫!不貴!點擊查看價格!


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

相關文章

    沒有相關內容
主站蜘蛛池模板: 亚洲色图欧美 | 欧美黄a | 18av在线视频 | 激情亚洲视频 | 欧美亚洲精品在线 | 亚洲第四页 | 操久久久| 青青草狠狠干 | 国产精品久久久久无毒 | 精品国偷自产在线不卡短视频 | 大香网伊人久久综合网2021 | 国产日韩欧美综合色视频在线 | 日韩欧美国产综合 | 欧美成人中文字幕在线视频 | 国产精品欧美日韩 | 91小鲜肉 | 高h猛烈做哭bl壮汉受小说 | 宅男深夜免费必看 | 国产色婷婷精品综合在线手机播放 | 一本大道香蕉大vr在线吗视频 | 国产高清自产拍av在线 | 国产精品日日摸夜夜添夜夜添1 | 深夜影院老司机69影院 | 一级毛片片 | 激情综合网站 | 波多野结衣中文字幕一区二区三区 | 久久久亚洲精品视频 | 精品午夜国产在线观看不卡 | 成视频年人黄网站免费视频 | 欧美亚洲国产片在线观看 | 亚洲伦理影院 | 国产精品自在线拍 | 一个人看的免费视频www免费 | 日韩三级黄 | 成年人毛片网站 | 91精品乱码一区二区三区 | 亚洲欧洲日本天天堂在线观看 | 日韩中文字幕在线免费观看 | 看欧美一级片 | 天天做天天爱天天怼 | 日鲁夜鲁鲁狠狠综合视频 |