TradingView
theCrypster
7 maj 2020 09:38

Fixed Percent Stop Loss & Take Profit % - For Study Scripts 

Bitcoin / U. S. DollarKraken

Opis

===========
Fixed Percent Stop Loss & Take Profit % - { FOR STUDY SCRIPTS! }
===========

A neat example of how to set up Fixed Stops and Take Profit as a percent of the entry price - This is for setting Alerts within your own Study Script for when either your SL or TP get hit.
Yup, that's about it!

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 Stops and Takes to your own scripts - hope it helps!

Set your "Open Long/Short" Alerts to be triggered "Once per Bar Close" - Set your "SL/TP" Alerts to trigger "Once per Bar".

--

We wrote this with a bit of a rush on! ~ If you spot any mistakes/bugs just let us know and we'll get round to them asap!

-----------

Good Luck and Happy Trading!
Komentarze
CryptoEngineer01
Hi mate thanks for this! Do you also have an example for multiple take profit levels? e.g. 3 levels. Thanks!
CindyADH
I was wanting to know this also.
confidentDinos55578
@CryptoEngineer01, Did you had luck to get this? could you share if so?
Nilesh280979
Excellent -

Can you help with code for stop-loss and target

Stop-loss = From buy signal, lowest low of last 5 candels.

And take profit = Buy signal + ( difference of buy price - Stoploss )
Pollard
As usual u r the best excellent work..keep it up..
theCrypster
@Pollard, Thanks! That means a lot! We've been working hard recently trying to improve our products and services, including writing this code! Thought it was too valuable for fellow Pine coders to keep under lock and key!
DorusvdB
how do i make a code where i just do for example

take short position at time 1500 take profit 30 pips stoploss 15 pips? because everywhere on the internet the only thing i can find is if that is that and if that is that. and if that level is that.
the only thing i want to code is

take short or long postion at time X with a take profit of 20 and stoploss 10 for example. everytime it passes that time.
and the strategy should be running between sunday markets open and friday markets closes.
ersineser
Thanks for sharing.
ARSAlgo
Hello mate , How can I put multiple tp by %. 1% will be first tp 2% will be 2nd tp .Like these I need 5TP.

How can I do?
TheWindicatorPro
@ARSAlgo, you'll need to duplicate portion of the script that sends the plot take profit and rename it
Więcej