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

您現(xiàn)在的位置:程序化交易>> 期貨公式>> 金字塔等>> 金字塔知識>>正文內(nèi)容

百度搜索

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

  • 咨詢內(nèi)容: 老師,您好~我想在代碼里實現(xiàn)以下規(guī)則:一,買入條件當EMA8上穿EMA21成立后,K線回落至EMA8,即close<=ema8時,發(fā)出買入指令;二,平倉條件當CLOSE>=ENTERPRICE*1.08時,發(fā)出平倉指令;三,止損條件當CLOSE<=ENTERPRICE*0.96時,發(fā)出止損指令;四,當條件分別成立時,在發(fā)出指令的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

     

  • 網(wǎng)友回復:

    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

     

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

 

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

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


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

相關文章

    沒有相關內(nèi)容
主站蜘蛛池模板: 香蕉在线精品亚洲第一区 | 日韩精品一区二区三区高清 | 黄色短视频免费在线观看 | 色偷偷人人 | 日韩高清成人毛片不卡 | 亚洲大胆美女人体一二三区 | 最近中文字幕高清字幕 | 亚洲第一区香蕉_国产a | 国产精品午夜高清在线观看 | 高清色黄毛片一级毛片 | 久草视频精品在线 | 日韩欧美一区二区三区视频 | 成年人黄视频大全 | 午夜爽爽性刺激一区二区视频 | 中国美女挠脚心丝袜vk | 福利视频第一页 | 在线亚洲欧国产精品专区 | 天天操操| 黄色一级片在线免费观看 | 无码免费一区二区三区免费播放 | 中文黄色片 | 午夜操操操 | 又爽又大又光又色的午夜视频 | 日本三级网站 | 成人黄视频 | 999国内精品视频免费 | 亚洲欧美韩日 | 亚洲人成一区二区不卡 | 最近2019中文 | 视频一区 欧美 | 国产欧美精品一区二区三区四区 | 91小视频在线观看免费版高清 | 一区二区三区久久精品 | 成人免费男女视频网站慢动作 | 午夜片在线| 成年视频免费观看 | 男女猛烈无遮挡性视频 | 涩涩动漫网站入口 | 国产一级片观看 | 久草在现| 免费污视频在线 |
网站统计