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.
Note di rilascio
Minor typos
Note di rilascio
Add the ability to disable trailing for demonstration reasons
Close open orders on trend reversal
Add sell labels on cross-under
Note di rilascio
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
Note di rilascio
Refactor stopValue calculation to be more readable
Note di rilascio
Fix longIsActive logic
Note di rilascio
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
Note di rilascio
Set calc on every tick to false by default, as fgo943 suggested
Note di rilascio
Minor Update the chart for a better overview and understanding of the trailing stop loss
Note di rilascio
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
Note di rilascio
Draw lines with width 1
Note di rilascio
Update to pinescript V5
Stop Loss step is now 0.05
Note di rilascio
Let's face it a Green-Red color model is more intuitive!
Note di rilascio
Happy New Year!
Many code refactorings and optimizations to better use this script as a template and plug your own strategy at ease
Note di rilascio
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!
Note di rilascio
(minor) refactoring
Note di rilascio
Use time_filters library
Note di rilascio
Minor revision update
Note di rilascio
Replace deprecated "when=" with if statements in strategy calls
Note di rilascio
Change fastMA default color to yellow
Note di rilascio
Increase max labels to 300
Minor refactoring
Note di rilascio
Update time_filters library
Note di rilascio
Some minor label/color changes
Note di rilascio
small refactoring
Note di rilascio
Update time_filters library version
Note di rilascio
Update time_filters library version
Note di rilascio
Use the 'chrono_utils' library for the date-time window filter
In pieno spirito TradingView, l'autore di questo script lo ha pubblicato open-source, in modo che i trader possano comprenderlo e verificarlo. Un saluto all'autore! È possibile utilizzarlo gratuitamente, ma il riutilizzo di questo codice in una pubblicazione è regolato dal nostro Regolamento. Per aggiungerlo al grafico, mettilo tra i preferiti.
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.