COCO研究院

 找回密碼
 註冊
搜索
查看: 3786|回復: 3

Ensign Volatility Stop

[複製鏈接]
發表於 10-6-11 16:37 | 顯示全部樓層 |閱讀模式
  1. _SECTION_BEGIN("Ensign Volatility Stop");

  2. // Ensign Volatility Stop
  3. // get the multiple of 9 period EMA of ATR_Ensign
  4. k=Param("multiplication factor", 1,0.5,5,0.1);

  5. period=k*9;
  6. VS_raw = 2.5 * EMA(ATR(1), period);

  7. // for longs, VS line is below price
  8. loline = VS_below_price = HHV(Close, period) - VS_raw;

  9. // for shorts, VS line is above price
  10. hiline = VS_above_price = LLV(Close, period) + VS_raw;
  11. between = IIf (C < hiline AND C > loline, 1, 0);
  12. up = IIf(C > hiline OR (H > Ref(H, -1) AND H > hiline), 1, 0);
  13. dn = IIf(C < loline OR (L < Ref(L, -1) AND L < loline), 1, 0);
  14. upcond = IIf(between AND BarsSince(up) < BarsSince(dn) , 1, 0);
  15. dncond = IIf(between AND BarsSince(dn) < BarsSince(up) , 1, 0);
  16. upline = IIf(up OR upcond, loline, Null);
  17. dnline = IIf(dn OR dncond, hiline, Null);

  18. Plot(C, "", colorLightGrey, styleBar);
  19. Plot(upline, "", colorRed, styleStaircase) ;
  20. Plot(dnline, "", colorGreen, styleStaircase) ;

  21. Buy=upline;
  22. Sell=dnline;
  23. Buy=ExRem(Buy,Sell);
  24. Sell=ExRem(Sell,Buy);

  25. PlotShapes(Buy*shapeUpArrow,colorGreen);
  26. PlotShapes(Sell*shapeDownArrow,colorRed);
複製代碼





2.jpg
發表於 10-6-11 16:51 | 顯示全部樓層
回復 1# alexwang7777


   建議把最下面兩行的語法顏色修改成適合台灣使用的箭頭顏色 2010-06-11_165042.jpg




  1. PlotShapes(Buy*shapeUpArrow,colorRed);
  2. PlotShapes(Sell*shapeDownArrow,colorGreen);
複製代碼
 樓主| 發表於 10-6-11 17:30 | 顯示全部樓層
^^忘了改顏色
發表於 10-6-11 19:41 | 顯示全部樓層
呵~改一下比較習慣
不錯呢謝謝分享
您需要登錄後才可以回帖 登錄 | 註冊

本版積分規則

手機版|Archiver|站長信箱|廣告洽詢|COCO研究院

GMT+8, 24-11-22 16:47

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回復 返回頂部 返回列表
理財討論網站 |