COCO研究院

 找回密碼
 註冊
搜索
查看: 10918|回復: 8

Bill William's Alligator System II

[複製鏈接]
發表於 10-6-11 17:56 | 顯示全部樓層 |閱讀模式
  1. /*
  2. Bill William's Alligator System II

  3. Reference Website:
  4. ==================

  5. http://www.alpari-idc.com/en/market-analysis-guide/chaos-theory/alligator-and-gator.html
  6. Modified from http://www.amibroker.com/library/detail.php?id=100, by Steve Wiser - slwiserr@erols.com
  7. Modified by TohMz on June 9th, 2008
  8. */
  9. SetChartOptions( 0, chartShowArrows|chartShowDates );

  10. _SECTION_BEGIN("Price Chart");
  11. _N(Title = StrFormat("{{NAME}}- {{INTERVAL}} {{DATE}} O= %g, H= %g, L= %g, C= %g (%.1f%%) V= " +WriteVal( V, 1.0 ) +"\n{{VALUES}}", O, H, L, C, SelectedValue(ROC( C, 1 )) ));
  12. PriceStyle = GetPriceStyle();
  13. PriceStyleOpt = ParamStyle("Price Style")|PriceStyle;

  14. if (PriceStyle==styleCandle)
  15. Plot( C, "", colorBlack, PriceStyleOpt);
  16. else
  17. Plot( C, "", IIf( Close >= Ref(C, -1), colorBlue, colorRed ), PriceStyleOpt);
  18. _SECTION_END();

  19. _SECTION_BEGIN("BW Alligator");
  20. /*** The trend indicators ***/

  21. P= ParamList("Price", "Close|(H+L)/2|(H+C+L)/3",1);

  22. if (P=="Close")
  23. A = C;

  24. else
  25. if (P=="(H+C+L)/3")
  26. A = (H+C+L)/3;
  27. else
  28. A = (H+L)/2;

  29. AlligatorJaw = Ref(Wilders(A,13),-8);
  30. AlligatorTeeth = Ref(Wilders(A,8), -5);
  31. AlligatorLips = Ref(Wilders(A,5), -3);

  32. Plot(AlligatorJaw, "Jaw", ParamColor("Jaw's Color",colorBlue),
  33. ParamStyle("Jaw's Style", styleThick));
  34. Plot(AlligatorTeeth,"Teeth", ParamColor("Teeth's Color",colorRed),
  35. ParamStyle("Teeth's Style", styleThick));
  36. Plot(AlligatorLips, "Lips", ParamColor("Lips's Color",colorGreen),
  37. ParamStyle("Lips's Style", styleThick));

  38. _SECTION_END();


  39. _SECTION_BEGIN("BW Fractal");

  40. UpFractal= ValueWhen(
  41. (Ref(H,-2) > Ref(H, -4)) AND
  42. (Ref(H,-2) > Ref(H, -3)) AND
  43. (Ref(H,-2) > Ref(H, -1)) AND
  44. (Ref(H,-2) > H), Ref(H,-2));

  45. DownFractal= ValueWhen(
  46. (Ref(L,-2) <= Ref(L, -4)) AND
  47. (Ref(L,-2) <= Ref(L, -3)) AND
  48. (Ref(L,-2) <= Ref(L, -1)) AND
  49. (Ref(L,-2) <= L), Ref(L,-2));



  50. //== Added Crash crashandburn59 [at] hotmail.com solution
  51. Plot(Ref(UpFractal,2), "Up Fractal", ParamColor("Up Fractal Color",colorRed),ParamStyle("Up Fractal Style", styleDashed));
  52. Plot(Ref(DownFractal,2), "Down Fractal",ParamColor("Down Fractal Color",colorBlue), ParamStyle("Down Fractal Style", styleDashed));

  53. //Plot(Max(HHV(H,3),Ref(UpFractal,2)), "Up Fractal", ParamColor("Up Fractal Color",colorRed), ParamStyle("Up Fractal Style", styleDashed));
  54. //Plot(Max(HHV(H,3),Ref(UpFractal,2)), "Down Fractal",ParamColor("Down Fractal Color",colorBlue), ParamStyle("Down Fractal Style", styleDashed));

  55. _SECTION_END();



  56. _SECTION_BEGIN("Exploration");

  57. Inc = 0.1;

  58. //== Set the Price Range for stock to scan
  59. PriceFrom = Param("Price From:", 5, 0.1, 200, Inc);
  60. PriceTo = Param("Price To:", 100, 0.1, 200, Inc);
  61. MaxBreakOut = Param("Max Breakout (%)", 5, 1, 30);
  62. MaxBreakOut = MaxBreakOut/100;

  63. Buy = C>UpFractal AND C<=(1+MaxBreakOut)*UpFractal AND
  64. AlligatorTeeth>AlligatorJaw;
  65. Sell = C<DownFractal AND C>=(1-MaxBreakOut)*DownFractal AND
  66. AlligatorTeeth<AlligatorJaw;

  67. Filter = (Buy OR Sell) AND (C>=PriceFrom AND C<=PriceTo) AND V>0;

  68. AddTextColumn(FullName(), "Security", 1.0, colorDefault, colorDefault, 200);
  69. AddTextColumn( WriteIf(Buy,"Buy", WriteIf(Sell, "Sell", "")), "Trade", 1.0);
  70. AddColumn( UpFractal, "Up Fratal");
  71. AddColumn( DownFractal, "Down Fratal");
  72. //AddColumn( MA(V,3)/EMA(V,17), "MAV(3/17)");
  73. AddColumn( C, "Today's Close");


  74. _SECTION_END();
複製代碼
發表於 10-6-11 19:14 | 顯示全部樓層
不錯喔謝啦
發表於 10-9-12 11:21 | 顯示全部樓層
感謝分享
已經納入收集了
發表於 10-10-7 15:52 | 顯示全部樓層
本帖最後由 nether 於 10-10-7 04:11 PM 編輯

請問這code要怎麼玩啊?
我backtest這code時 得到下面 errror message:
Missing Short/cover variable assignment:
Check User's guide: Tutoirial: Backtesting your trading idea for the details

請問這是什麼問題? 那裏要設定呢?


謝謝
發表於 10-10-7 16:01 | 顯示全部樓層
因為這個公式沒有設定空補發生條件 而你backtest有選雙邊回測吧
發表於 10-10-7 16:14 | 顯示全部樓層
對 您說對了 現在ok 了
感謝感謝
發表於 10-12-27 13:47 | 顯示全部樓層
感謝大大的分享,收集起來
發表於 11-3-27 04:00 | 顯示全部樓層
感覺
Alligator System II 可以衡量速度
愈是恐慌所造成的速度愈快,但速度愈快,回到原點的機會就愈高
發表於 15-11-6 22:58 | 顯示全部樓層
Thx!!
您需要登錄後才可以回帖 登錄 | 註冊

本版積分規則

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

GMT+8, 24-12-22 00:20

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

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