BacktestRookies

Average Down

This strategy has been published for a Pyramiding tutorial on the Backtest Rookies website.

For a full overview of the code and an introduction to Pyramiding check out our site.

Summary
The code example will create a simple script that allows us to average down whenever our portfolio is down x%. The idea will be to bring our average cost down so that we can still exit with a profit when conditions improve. With this in mind, the strategy shall also have a simple take profit exit at x% above our average price.

Inputs

  • Target Loss to Average Down (%): This is the target percentage level will trigger us to average down. In other words, if we have a close below this level from our average buying price, we will average down.
  • Target Take Profit: A standard take profit percentage level. Use this to set how much profit you will target.
  • % Of Current Holdings to Buy: Is the number of shares/contracts we will aim to buy when we average down. 50 will mean we buy 50% of our current holdings. So if we have 100 shares, then we buy 50 when we average down.
  • SMA Period: Defines our SMA lookback period. Our strategy will enter the first/initial position when we have a close above our SMA level.



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

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

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

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

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