Evaluating Candle Patterns in a trading system.afl
上传用户:shiqiang
上传日期:2009-06-12
资源大小:1289k
文件大小:1k
源码类别:

金融证券系统

开发平台:

Others

  1. //------------------------------------------------------------------------------
  2. //
  3. //  Formula Name:    Evaluating Candle Patterns in a trading system
  4. //  Author/Uploader: Herman van den Bergen 
  5. //  E-mail:          psytek@magma.ca
  6. //  Date/Time Added: 2005-01-28 17:54:38
  7. //  Origin:          
  8. //  Keywords:        
  9. //  Level:           medium
  10. //  Flags:           system
  11. //  Formula URL:     http://www.amibroker.com/library/formula.php?id=426
  12. //  Details URL:     http://www.amibroker.com/library/detail.php?id=426
  13. //
  14. //------------------------------------------------------------------------------
  15. //
  16. //  A simple example program to show how one can evaluate candle patterns in a
  17. //  simple trading system. Use the AA param() to select Long or Short only mode
  18. //  and to set the profit period after the pattern. Run in Optimize on stock or
  19. //  watchlist.
  20. //
  21. //------------------------------------------------------------------------------
  22. #include <CandleFunctionsInclude.afl>
  23. SetTradeDelays(1,1,1,1);
  24. // remember to set BuyPrice, SellPrice, etc.
  25. Md = ParamToggle("System Mode","Long Only|Short Only",0);
  26. CP = Optimize("CP",0,0,44,1);
  27. PP = Optimize("PP",1,1,5,1);
  28. if(Md)
  29. {
  30. Buy = CandlePattern(CP);
  31. Sell = Ref(Buy,-PP);
  32. Short = Cover = 0;
  33. }
  34. else
  35. {
  36. Short = CandlePattern(CP);
  37. Cover = Ref(Short,-PP);
  38. Buy = Sell = 0;
  39. }