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


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

相關文章

    沒有相關內容
主站蜘蛛池模板: 热综合一本伊人久久精品 | 欧美色网络 | 老司机毛片 | 福利免费观看 | 黄色大片在线播放 | 日本xxx18hd| 日韩一本在线 | 91久久综合精品国产丝袜长腿 | 成年人免费看片 | 日韩午夜影院 | 欧美激情视频一区二区 | 久久久久久久久97 | 欧美在线视 | 欧美性受xxxx视频 | 欧美在线视频导航 | 日韩字幕| 无遮羞禁黄动漫在线观看 | 天堂中文字幕 | 中文字幕在线观看一区二区 | 成人午夜免费视频毛片 | 伦理在线看 | 日本在线视频一区二区三区 | 亚洲色啦啦狠狠网站 | 波多结衣一区二区三区 | 青草青草久热精品视频在线网站 | 久国产精品视频 | 窝窝视频成人影院午夜在线 | 91看片在线 | 日韩电 影在线播放 | 俄罗斯一级毛片aaaa | 国产乱视频 | 日韩国产成人精品视频人 | 日韩免费无砖专区2020狼 | 亚洲黄色一级 | 在线久操 | 特级全黄| 91香焦国产线观看看免费 | 亚洲欧美在线免费 | 成年人视频在线免费播放 | 国产一区二区三区美女秒播 | 香蕉视频污污 |