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!
Versionshinweise: UPDATE - Added "plot numbers" instead of plot names to give Alerts more consistent values when triggered.
Von Favorisierten Skripten entfernen Zu Favorisierten Skripten hinzufügen
==============
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
==============

Kommentare

Also, how come the shorts and longs trigger without a close a lot of the time?
Antworten
Hey, I like these. Curious, what is the point of the move TSL?
Antworten
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 %.
Antworten
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! :)
Antworten
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
Antworten
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
Antworten
Startseite Aktien-Screener Forex-Screener Krypto-Screener Wirtschaftskalender So funktioniert es! Chartmerkmale Preise Einen Freund empfehlen Hausregeln Hilfe Center Webseite & Brokerlösungen Widgets Charting Lösungen Lightweight Charting Library Blog & News Twitter
Profil Profileinstellungen Konto und Abrechnung Angeworbene Freunde Coins Meine Support Tickets Hilfe Center Veröffentlichte Ideen Followers Ich folge Private Nachrichten Chat Abmelden