BenHampson

KAMA Strategy - Kaufman's Adaptive Moving Average

BenHampson ที่อัปเดต:   
This strategy combines Kaufman's Adaptive Moving Average for entry with optional KAMA , PSAR, and Trailing ATR stops for exits.

Kaufman's Adaptive Moving Average is, in my opinion, a gem among the plethora of indicators. It is underrated considering it offers a solution that intuitively makes a lot of sense. When I first read about it, it was a real 'aha!' moment. Look at the top, pink line. Notice how during trending times it follows the trend quickly and closely, but during choppy, non-trending periods, the KAMA stays absolutely flat? Interesting! To trade with it, we simply follow the direction the KAMA is pointing. Is it up? Go long. Is it down? Go short. Is it flat? Hold on.

How does it manage to quickly follow real trends like a fast EMA but ignore choppy conditions that would whipsaw a fast EMA back and forth? It analyses whether recent price moves are significant relative to recent noise and then adapts the length of the EMA window accordingly. If price movement is big compared to the recent noise, the EMA window gets smaller. If price movement is relatively small or average compared to the recent noise, the EMA window gets bigger. In practice it means:

  • The KAMA would be flat if a 20 point upwards move occurred during a period that has had, on average, regular 20 point moves BUT
  • the KAMA would point up if a 20 point move occurred during a period that has, on average, had moves of only around 5 points.

In other words, it's a slow EMA during choppy flat / quiet flat periods, and a fast EMA as soon as significant volatility occurs. Perfect!

-----

The Strategy
The strategy is more than just a KAMA indicator. It contains:

  • KAMA exit (optional)
  • ATR trailing stop loss exit (optional)
  • PSAR stop loss exit (optional)
  • KAMA filter for entry and exits
  • All features are adjustable in the strategy settings

The Technical Details:
Check out the strategy's 'Inputs' panel. The buy and sell signals are based on the 'KAMA 1' there.
  • KAMA 1: Length -- 14 is the default. This is the length of the window the KAMA looks back over. In this instance, it c
  • KAMA 1: Fast KAMA Length -- 2 is the default. This is the tightest the EMA length is allowed to get. It will tend towards this length when volatility is high.
  • KAMA 1: Slow KAMA Length -- 20 is the default. This is the biggest the EMA length is allowed to get. It will tend towards this length when volatility is low.

KAMA Filter
The strategy buys when the KAMA begins to point up and sells when the KAMA points down. Generally, the KAMA is very good at filtering out the noise itself - it will go flat during noisy/choppy periods. But to add another layer of safety, its author, Perry Kaufman, proposed a KAMA filter. It works by taking the standard deviation of returns over the length of the the 'KAMA 1: Length' I mentioned above and multiplying it by an 'Entry Filter' (1 by default) and 'Exit Filter' (0.5 by default). The entry condition to go long is that the KAMA is pointing up and and it moved up more than 1 x St. Dev. of Returns. The exit condition is when the KAMA is pointing down and it moved down by more than 0.5 x St. Dev. of Returns.

Thanks
Thanks to ChuckBanger, cheatcountry, millerrh, and racer8 for parts of the code. I was able to build upon their good work.

-----

I hope this strategy is helpful to you.

Do you have any thoughts, ideas, or questions? Let me know in the comments or send me a message! I'd be glad to help you out.

If you need an indicator or strategy to be built or customised for you, let me know! I'll be glad to help and it'll probably be cheaper than you think!
เอกสารเผยแพร่:
Updated to v5.

สคริปต์โอเพนซอร์ซ

ด้วยจิตวิญญาณของ TradingView อย่างแท้จริง ผู้เขียนสคริปต์นี้ได้เผยแพร่เป็นโอเพนซอร์ส เพื่อให้ผู้ค้าสามารถเข้าใจและตรวจสอบได้ ไชโยให้กับผู้เขียน! คุณสามารถใช้ได้ฟรี แต่การใช้รหัสนี้ซ้ำในสิ่งพิมพ์อยู่ภายใต้กฎของบ้าน คุณสามารถตั้งเป็นรายการโปรดเพื่อใช้บนชาร์ตได้

คำจำกัดสิทธิ์ความรับผิดชอบ

ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมที่ เงื่อนไขการใช้บริการ

ต้องการที่จะใช้สคริปต์นี้บนชาร์ตใช่ไหม?