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!
Catatan Pelepasan: UPDATE - Added "plot numbers" instead of plot names to give Alerts more consistent values when triggered.
Keluarkan daripada Skrip Pilihan Tambah kepada Skrip Pilihan
==============
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
==============

Komen

Also, how come the shorts and longs trigger without a close a lot of the time?
Balas
Hey, I like these. Curious, what is the point of the move TSL?
Balas
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 %.
Balas
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! :)
Balas
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
Balas
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
Balas
Laman Utama Penyaring Saham Penyaring Forex Penyaring Kripto Kalendar Ekonomi Bagaimana ia berfungsi Ciri-ciri Carta Harga Rujuk rakan Peraturan Dalaman Pusat Bantuan Laman web dan Penyelesaian Broker Widget Penyelesaian Pencartaan Perpustakaan Pencartaan yang Ringan Blog & Berita Twitter
Profil Tetapan Profil Akaun dan Pengebilan Kawan-kawan yang dirujuk Coin Tiket Sokongan Saya Pusat Bantuan Idea yang diterbitkan Pengikut Mengikuti Mesej Peribadi Sembang Daftar Keluar