theCrypster

Percent Trailing Stop (%) - For Study Scripts

===========
Percent Trailing Stop (%) - { FOR STUDY SCRIPTS }
===========

Wow - this is an example of how to implement Alerts relating to a Trailing Stop (%) within your Study Script. It's taken a bit of effort to get this working but I think we got there!

Alerts include Open Long/Short, Trailing Stop Hit, and (the most important one) Movement of Trailing Stop! <- this is actually really quite good, by the way! :)

You can ignore the actual entry/exit orders - they're based on a simple MA cross and are therefore NOT relevant, NOT profitable and NOT recommended!

You should be using this code as a way of adding a Trailing Stop to your own scripts - hope it helps!

Set your "Open Long/Short" Alert to "Once per Bar Close" - Set your "Trailing Stop Hit" Alert to "Once per Bar" - Set your "Move TSL" Alert to "Once per Bar Close". - You're all done! Enjoy.

-----------

Good Luck and Happy Trading!
Notes de version: UPDATE - Added "plot numbers" instead of plot names to give Alerts more consistent values when triggered.
Supprimer des scripts favoris Ajouter aux scripts favoris
==============
https://www.theCrypster.com
-----------
> Full Access on our website. 7-Day Free Trial. Crypto Tipster & Crypto Scalper Strategies. Stunning Past Performance
-----------
https://twitter.com/TCrypster
==============

Commentaires

Also, how come the shorts and longs trigger without a close a lot of the time?
Répondre
Hey, I like these. Curious, what is the point of the move TSL?
Répondre
I think there is a issue as it only takes closing price of the candle and ignores wicks. So if the wick is quite large, there will be even higher discrepancy from the set %.
Répondre
theCrypster Supernova432
@Supernova432, Hey Supernova - thanks for getting in touch.

If I understand you correctly, it's actually designed to ignore wicks as you'd want your SL line to mimic close prices - not the high/low (wicks).

If we included wicks in the SL formula (instead of close price) you could end up with an SL price higher (assuming you're Long) than the bar close price, which would end up with confusion whether trading manually or (more importantly) through an auto trading bot.

Let us know if we understood your comment correctly! :)
Répondre
Supernova432 theCrypster
@theCrypster, thankyou for the clarification. What if you plot the stoploss line after you have confirmed the candle close (using one of the tradingview functions) and once confirmed you can calculate using highest/lowest function the exact price for the stoploss line including the wicks. This will make script more accurate in my opinion, cheers
Répondre
theCrypster Supernova432
@Supernova432, Aah! I think I understand now - we've actually included a similar (if not the same!) SL format as the one you've mentioned within our Crypto Tipster strategy.

It looks back a certain period (defined by the user) to find the HL's from that pre-defined range, and places the SL at that high or low. We've then added a % offset to this HL price, so you can tweak and adjust the HL stop by a certain % up or down to suit your needs/requirements.

I'm not going to be publishing this script for public access. But given the info ^ you should be able to write that code for yourself!

All the best
theCrypster
Répondre
Accueil Screener d'actions Screener Forex Screener Crypto Calendrier économique Comment ça marche Caractéristiques du graphique Prix Parrainer un ami Règles de conduite Centre d'aide Solutions site web & courtier Widgets Solutions de cartographie Bibliothèque de graphiques allégés Blog & News Twitter
Profil Paramètres du Profil Compte et Facturation Amis référés Coins Mes tickets au support Centre d'aide Idées Publiées Followers Suivi(e) Messages privés Chat Se Déconnecter