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

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

[求助]請(qǐng)教老師一個(gè)問題 [金字塔]

  • 咨詢內(nèi)容: 老師,您好~我想在代碼里實(shí)現(xiàn)以下規(guī)則:一,買入條件當(dāng)EMA8上穿EMA21成立后,K線回落至EMA8,即close<=ema8時(shí),發(fā)出買入指令;二,平倉(cāng)條件當(dāng)CLOSE>=ENTERPRICE*1.08時(shí),發(fā)出平倉(cāng)指令;三,止損條件當(dāng)CLOSE<=ENTERPRICE*0.96時(shí),發(fā)出止損指令;四,當(dāng)條件分別成立時(shí),在發(fā)出指令的K線,做上標(biāo)記;
    寫的代碼如下,但一直沒有信號(hào),請(qǐng)您改錯(cuò)并指正一下,非常感謝~
    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,"平倉(cāng)");   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;

     

  • 用戶回復(fù):

    老師,您好:

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

    當(dāng)頭寸持倉(cāng)盈利超過+4%后,若再次跌破EMA21,則止損離場(chǎng);若盈利超過+8%,則止盈。

    但代碼還是顯示不出來(lái)。

    麻煩您能看一下嗎?

     

    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)友回復(fù):

    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)友回復(fù): 請(qǐng)教老師關(guān)于這行代碼: if barslast(cross(ema8,ema21))>0 and close<=ema8 then因?yàn)閎arslast(cross(ema8,ema21))>0 代表了該條件成立,但當(dāng)cross(ema21,ema8)之后,也會(huì)有做多信號(hào)發(fā)出。 若只想在可以cross(ema8,ema21))和cross(ema21,ema8)之間發(fā)出做多信號(hào),需要添加什么條件? 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;

 

有思路,想編寫各種指標(biāo)公式,程序化交易模型,選股公式,預(yù)警公式的朋友

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


【字體: 】【打印文章】【查看評(píng)論

相關(guān)文章

    沒有相關(guān)內(nèi)容
主站蜘蛛池模板: 国产在线欧美精品中文一区 | 亚洲欧美视频二区 | 欧美日韩视频在线第一区 | 美女黄色在线观看 | 曰皮视频在线播放免费的 | 日本国产黄色片 | 99riav视频国产在线看 | 99精品国产第一福利网站 | 日韩在线你懂的 | 15xxxx18日本娇小 | 美女福利视频导航 | 久久久久久88色愉愉 | 欧美特级黄色片 | 99热色 | 国产网曝手机视频在线观看 | 免费午夜影片在线观看影院 | 亚洲成人中文字幕 | 免费在线观看中文字幕 | 国产盗摄一区二区欧美精品 | 亚洲综合一二三区 | 免费看片aⅴ免费大片 | 黄色在线免费看 | 久久精品国产波多野结衣 | 在线观看免费视频黄 | 中文毛片无遮挡高清免费 | 日本特黄特色aaa大片免费欧 | 欧美色p | 78m成人免费视频 | 欧美日韩精品免费一区二区三区 | 国产精彩| 天天干天天操天天摸 | 狠狠干.com | 国产精品久久久久久久人人看 | 天天操人人爱 | 国产色手机在线观看播放 | 无遮免费网站在线入口 | 欧美精品亚洲人成在线观看 | 中文字幕午夜乱理片11111 | 77se77亚洲欧美在线大屁股 | 2020国产成人精品视频人 | 精品色视频 |