TradingView stop loss Take profit

YouTube Video

YouTube Video Transcript

[Music] hey this is David for big bits in this video our tenth video in the pine script development tutorial series we are going to talk about percentage based profits and stop losses so these are actually going to be market orders with the strategy and if youve been following along youll notice Ive cleaned up the strategy quite a bit its very basic if youve just joined in this video its gonna look kind of dumb because the strategy is just worthless when youre looking at it but thats because weve made it highly flexible and this is just an example for the tutorial series now you can see the strategy has it by when we have the crossover of our first moving average over the second one and weve added in the new feature of the take profit or stop-loss which had it exit here with a stop loss of 15% now I get into how that works again in just a minute but we also had a buy here and it continued to sell with our old strategy settings of crossing under the second moving average as well so weve managed to add in our take profit and stop-loss alongside of our moving average crossovers that we use to also potentially exit the trades now if all this sounds confusing in your head and watch the previous videos its probably a good idea to go back and maybe even start from the beginning so lets continue on and lets take a look at how this is actually done now the only difference weve made in our actual strategy entries or exits is weve added a new line in every condition where we had an entry we placed an exit and what the exit does it essentially triggers a market order once your profit gets hit or your loss gets hit now these are all different parameters in the exit function and lets take a look the first one is profit or lot the profit or loss excuse me and thats the text youre gonna see here on the strategy itself when it prints on the chart and weve associated that with the one over to entry ID and we have created a new called profit target and a new variable called lost target these are used to calculate the percentage differences so that we can actually get the right numbers for it to exit at no matter what we are looking at now Ill go over how we calculate those in just a minute but lets go over how the profit and loss targets actually work when youre working with the exit now keep in mind we are just doing market orders there is an option to use a limit order to take profit its not a big deal to me to use the market orders personally I dont trade very often with strategies might look at a daily chart and trade on strategies so theres probably not gonna be a lot of trades going on for me so the market fees arent that big of a deal but if youre interested in using limit orders to trade shorter timeframes and in most cases you get better fee rates on limit orders so you might want to consider using limit for your take profit instead of a market order but were going to use market and when we do this we have to give the parameter a value that it expects and that value is based in ticks now what a tick is that is the interval between prices shown on the chart and lets go back to our chart here you can see the interval on our chart here is based in pennies since were using the US dollar as our base currency here so each tick is point zero one dollars or one cent now if we wanted to set our take profit exactly one dollar above where our entry was we would have to use 100 ticks so to do this with percentages we have to calculate it and the same thing goes for the loss parameter its also calculated in ticks now its important to note that the loss isnt really a negative number that youre working with the the system knows that the loss is a negative number the measurement in ticks is just that its a measurement so its gonna be a positive number so if youre going down you dont have to use a negative tick number its just a measure of distance downward and the system knows that and Ill show you how we calculate that in just a moment but before we do the catch thats right here Ill explain that all much better in just a moment but lets take a look we had to add some new inputs here we added our take profit percentage and our stop loss percentage we have the minimum value at point zero one and once again thats because they have to be positive numbers even though youre setting a loss below where you enter and I set the step size which is the interval between the values on the settings to point five well just half a percent if you need to tune that down you can just change it to 0.25 or 0.1 whatever you want but let me show you the settings here and show you how this is gonna actually impact the chart now I have some arbitrary numbers of 30 and 15 percent said its the profit and loss respectively and this probably wont work for most people it probably wouldnt even work for me but for our example purpose here Im going to change the stop-loss percentage to 15.5% and you should see that this actually moves down to the next candle because the percentage down increased now you can see I just kind of proved my point that the percentage increases on the stop-loss means it goes down further and you dont have to use a negative percentage on tradingview like that so Im just gonna save our changes to our settings there Im gonna go back down lets look at our calculations for how we calculated how many ticks we would need now the profit target this is a pretty straightforward calculation we have our clothes times our percentage divided by how many ticks we have now let me explain this and I can actually kind of show you through some of the math here our take profit percentage is 30% now we have to divide that by 100 so we get the actual value we need to multiply the close by so if its 30% and we have the number 30 we have divided by 100 we now have 0.3 okay if the price were say $10,000 and that was the close we would multiply that by 0.3 which is $3,000 now if we were to just use 3000 ticks and I remember the ticks are point zero one on this chart so if we did 3000 of those that would only be 30 dollars up for our take profit and thats not what we want we want 30% based on the example which would be 3000 so we divide that 3000 by the minimum tick size by that point zero one and now its I believe 300,000 so now itll actually place the product the the take profit up three thousand dollars at 13,000 and similarly we do the same exact calculation for the Lost Target we just use the stop-loss percentage instead in that calculation so there you have it thats really all there is to it Im trying to think if theres really anything else to do here with the staff lock the stop loss and take profit I really dont think there is in this video you can see where we entered and where we exit if you have an idea of something you like to see added to this please leave a comment if you liked the video definitely please like it if you like videos like this please subscribe Im always coming out with new ones related to development Trading cryptocurrency those sorts of things so I would really appreciate that if you would but stay tuned to the next video and you know have a great day [Music]

YouTube Video Description

< br/> IMPORTANT LINKS BELOW

TradingView Take Profit & Stop Loss: In this TradingView Pine Script Tutorial we discuss how to apply a customizable Take Profit and Stop Loss onto our strategy. With these customizable settings, you can adjust your percentage Take Profit and Stop Loss on the fly to quickly re-evaluate your strategy with these new values. With Pine Script it is very easy for even beginners to create their own indicators or strategies that have many other indicators within them. Once we have completed the script, we can see our results immediately and begin working with more functions, indicators and strategies.

‍️‍️‍️‍️‍️‍️‍️‍️‍️‍️
Social and other public profiles
‍️‍️‍️‍️‍️‍️‍️‍️‍️‍️
Website: //www.bigbits.io
Discord: //discord.gg/rapMn4z
Twitter: //twitter.com/BigBitsIO
Facebook: //www.facebook.com/BigBitsIO/
‍GitHub: //github.com/BigBitsIO
TradingView: //www.tradingview.com/u/BigBitsIO


Referral links

Buy, Sell and Trade Crypto on Binance.US with LOW fees: //www.binance.us/?ref=35105151
‍️ Want to buy crypto? Get $10 of bitcoin w/ your first purchase over $100: //www.coinbase.com/join/johnso_dxz
Sign up for a paid plan at TradingView and receive a $30 credit: //www.tradingview.com/gopro/?share_your_love=BigBitsIO
Browse privately and get rewarded with Brave Browser: //brave.com/big406
Receive bonus perks when purchasing Lightnite Game: //lightnite.io/ref=BigBits
VIEW ALL HERE: //bigbits.io/bigbits-referrals/

️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️
DISCLAIMER: All my videos are for educational and entertainment purposes only. Nothing in this or any of my videos should be interpreted as financial advice or a recommendation to buy or sell any sort of security or investment including all types of crypto coins and tokens. Consult with a professional financial advisor before making any financial decisions. Investing in general and particularly with crypto trading especially is risky and has the potential for one to lose most or all of the initial investment. In simple terms, you are responsible for your actions when trading.
️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️

#bitcoin #crypto #cryptocurrencies #tradingview #binance #binanceUS #coinbase

This channel focuses on Bitcoin, Ethereum, LiteCoin, Ripple, Link, Basic Attention Token and almost all cryptocurrencies that demand attention. Please like the video if you liked the video, and subscribe if you like these types of videos. David from BigBits is an experienced Software Engineer, but no one is perfect, If you find any issues with any of the open-source, free code, or code shown in videos please comment to let us know what to fix, we listen to our viewers!

Video liên quan

Chủ Đề