OPEN-SOURCE SCRIPT
업데이트됨

Trailing Stop Loss

16 645
This script demonstrate how to make a Training Stop Loss to "ride the wave". In comparison to classic Stop Loss this strategy follows the price upwards (for long positions) and when price drops by a fixed percentage then you exit your position.
릴리즈 노트
  • Minor typos
릴리즈 노트
  • Add the ability to disable trailing for demonstration reasons
  • Close open orders on trend reversal
  • Add sell labels on cross-under
릴리즈 노트
  • Fix a bug that made Stop Loss to not trigger appropriately when it was reached at the very first candle end enable trailing was un-checked
릴리즈 노트
  • Refactor stopValue calculation to be more readable
릴리즈 노트
  • Fix longIsActive logic
릴리즈 노트
  • Check if time is within backtest period in order to set the price to prevent unnecessary calculations and drawing outside the area of interest
  • Replace deprecated trasp argument with color.new
릴리즈 노트
  • Set calc on every tick to false by default, as fgo943 suggested
릴리즈 노트
  • Minor Update the chart for a better overview and understanding of the trailing stop loss
릴리즈 노트
  • Fix a bug that were causing stop loss to be calculated wrong when there was new entry back to back with the end of the previous one
  • Use strategy.percent_of_equity
릴리즈 노트
  • Draw lines with width 1
릴리즈 노트
  • Update to pinescript V5
  • Stop Loss step is now 0.05
릴리즈 노트
  • Let's face it a Green-Red color model is more intuitive!
릴리즈 노트
  • Happy New Year!
  • Many code refactorings and optimizations to better use this script as a template and plug your own strategy at ease
릴리즈 노트
  • Bug fix: (rare/minor) Remove 'strategy.position_size == 0' condition in stop loss calculation that made the very first stop loss price target to be calculated based on previous 'strategy.position_avg_price' instead of 'close' if the previous position closed exactly one bar before!
릴리즈 노트
  • (minor) refactoring
릴리즈 노트
  • Use time_filters library
릴리즈 노트
  • Minor revision update
릴리즈 노트
  • Replace deprecated "when=" with if statements in strategy calls
릴리즈 노트
  • Change fastMA default color to yellow
릴리즈 노트
  • Increase max labels to 300
  • Minor refactoring
릴리즈 노트
  • Update time_filters library
릴리즈 노트
  • Some minor label/color changes
릴리즈 노트
  • small refactoring
릴리즈 노트
  • Update time_filters library version
릴리즈 노트
  • Update time_filters library version
릴리즈 노트
  • Use the 'chrono_utils' library for the date-time window filter
릴리즈 노트
  • Add different alert messages per event
  • Update 'chrono_utils' library
릴리즈 노트
  • Update to pinescript version 6

면책사항

이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.