Another really amazing lesson. Very well explained, so as a noob I'm having no issue following what you are saying. Seriously Matt, thank you very much for your efforts!
@@TheArtOfTrading :) I'm looking forward to them almost as much as I am looking forward to having a keyboard with 2 working shift keys....gods I can't wait to have 2 working shift keys again :P
@@faenorsjewel5618 hahaha yeah I feel you! I spilled a drink all over my keyboard last night while I was doing some editing and now mine is playing up too 🙁
i very rarely comment on anything but this is is a truly OUTSTANDING introduction, understands you have to walk before running Only suggestion is when starting a script put a few blank lines at end and type above these...in the middle of the text pane... so that when people pause the RUclips progress/volume bar is not in the way
Really good. Just like my C++ instructor you remind me of him so much. Love that you give uses for the code when you explain it. Really help me have a basis for creating my own scripts.
Hi Matthew! First of all want to really thank u for your vids. They are amazing and u r an awesome tutor! For someone with zero coding experience (and frankly dislike/fear), u have made the videos and lessons surprisingly well-taught and enjoyable. have loved each one of your lessons so far and am sure gonna enjoy the others as well equally.
Hey Matt, I searched all over for a tutorial on writing a Trailing Stoploss based on price reached. All I could find including in your channel is ATR or Percentage based Trailing Stoploss. My script takes Inputs of Pips for Stoploss and RR for Profit. I would like to move my Stoploss to Breakeven when a trade reaches 1.5R Profit and then move it to 1R when a trade reaches 2R Profit. Simple and Fixed values.
Awesome. So much easy to understand. I'm at 7 th lesson. Looking for strategy based learning. Hope it will come ahead. Thanks for your efforts and hardwork.
Superb! Had to watch several times to make sure I got the maths behind it, but finally got it. Really well explained, love that you explain in simple terms bit by bit what each line of code is doing and why. Its key to learning. Also seeing it explained on the chart as we go, that's great too. I think the transparency code is outdated now in v5 (I got an orange message about it at the bottom), so for anyone that may be looking for what seems like the new way? I used this - plot(atr, title="ATR", color=color.new(color.blue, 100))
Thank you so much Its very practical. like some of comments below i rarely left comments but your demonstration is amazing that's easy to understand for everyone. BTW I also love your voice and accent as well as your ending words " trade green and good luck with your coding" Haha
Absolutely fabulous! Thx mate. Subscribed immediately! Would even be sper fabulous if you could connect it to automatically adjust your stop-limit order. That would me smashing!
Thanks for this, great video ! Got a question, when I make a strategy, and set STOP LOSS or TAKE PROFIT, based on ATR, for obvious reasons it never gets hit, because it is dynamic. How can I set a stop Loss or a Take Profit based on ATR or BB, but keep it fixed as a historic value ? Quick example: the Price now is 10.000, and the upper BB value is 10200 and the lower is 9800. I want set a Short trade with STOP LOSS on 10200 and a Take profit at = current price - (stop loss - current price) * 2 . What gives us 9600.
You have not written a code for trailing stop loss (ATR) but you have created a code to calculate a lower and upper band (with a multiplier) starting from the ATR. Good explanation, but the code to contextualize the content with the title is missing.
The idea behind this indicator is to trail your stop loss based on where you entered your position (eg., if you entered long, then you trail your stop loss higher as the trailing ATR moves higher, and you ignore times when it dips, until you're stopped out. That's how I use it anyway). In order to code an actual trailing stop indicator, you need to tell Pine when and where you entered your position, which is much more complex. I think you might find this lesson more useful if that's what you're trying to do: ruclips.net/video/WM8qOjKimUk/видео.html
@@TheArtOfTrading I'm happy with the quick response to my comment, I'm glad. Anyway, I don't write the code in Pine but on python so I was just interested in understanding the logic of the code and then rewriting it myself. The point is that the cumulative maximum (or cumulative minimum if short) condition is missing. Of course, as you say then the entry point influences the volatility and therefore the distance of the stop loss from the price series, but all I wanted to say was that this very trivial condition was missing to make it a real trailing stop loss code. Thanks anyway for the explanation in the video which remains exhaustive;)
Nice video. Is it possible to do a presentation on plotting alternate trailing stops for short and long rather than plotting both the lines simultaneously?
Great course! Thank you for these videos. I'm a really no-tech guy, so maybe you could help me. How to use this ATR TP and SL in backtesting the strategy? I can't come up with any working code that would set up my exit at either ATR TP or ATR SL when the ATR should be based on a candle that I enter the trade. Hope it's understandable :D Do you have any ideas?
Hello Marcin. I know it's quite some time ago but did you manage to get the code working for the above mentioned backtesting system? I'm in search for the exact code.
hey bro question is it possible to used stop Loss moved automatically adjust/moved using PaperTrading ,same as u've done on OANDA Autoview thnx 4 ur time Keep Safe i've enjoy ur Free Lesson Keep it Up i've Learn alot
one thing though, the price will never fall below the stop unless you are looking at the stoploss indicator yesterday. So, how do we move the graph, so we can see it break through?
Is it possible to have write a script that has indicators on the top, such as Moving average and Bollinger Band along with indicators on the bottom such as ADX and TSI? Going off the videos I've seen the overlay function only allows one or the other with the True/False setting.
Hey buddy, that's an awesome tutorial. I have been searching for something like this for long time. Just found your channel today and i want to make a personnel request. can you please make a video on how to create an alert on tradingview using short or long trailing stop combined with another indicator into one single code ? For example, an alert when short trailing stop is crossing the 200 EMA in one single code.
Het Mathew, great stuff as always. one question: on minute 18.00 how do you plot these dashes for stop loss and take profit? I have tried using stepline, yet it still connects the trailing line: plot(longstop, title= "long trail stop", style=plot.style_stepline, color=color.new(color.silver,60))
Good video. But here the trailing Stop should be calculated till previous day close. Otherwise we will never have price crossovers as the trailing Stop will always be lower than the current close price..
If I am in a long is there a way to get the trailing stop to find the highest high of that trend regardless if it was 3 bars back, 7 bars back or 50 bars back? Like as long as I'm in a long position, use the highest high you find to calculate the trailing stop with the ATR? I'd like to be able to not get out of obvious trends because of a small pull back.
have been watching all your tutorials. Could you make a video for algo trading with Tradingview pine script? There are autoview with pink and Algostudio out there that can make pine script automated but do not know how to proceed
the script I am modifying was made in 2017, it seems there is an incompatibility of some sort - when I put in // @version=4 then it does not get compiled at the end
thank you for the video! Im having struggle to keep the ATR value at the entry price, I would like to take profit at 1.5 * atr of my entry price and not "trailing" how can i do that?
Good lesson man, though for the plot(atr) line 18. Why would we bother changing the transparency to 100? Wouldn't it be simpler to just remove that line entirely?
Thanks a lot for the video guy. I have a question, Is there any way we can plot the atr in a new pane while overlay is set to true but still want the trailing stop to be plotted on the price chart?
Really amazing Lesson, My self Ravi from INDIA Can you please make a lesson on increased Volume's High or Low gone by price, then it give signals One more thing can you please make a lesson video on RSI BreakOut Signals, it would be really appreciate, Thank u so much.
damn this helped me out so much! thanks for this! i'm having a lil problem with the auto scale function when i plot this indicator to the screen. It wants to show 0 on the BTC chart which makes all my candles squeezed together. any way i can fix this?
lets take stock price is 100 and it has support and resistance at 98 and 102 for the 23-march -2020.. now this support and Resistance i.e 98 and 102 =x how to check this x is equal to previous any same support and Resistance suppose previous 98 cames as support two times and now on 23 march this 3 rd time when 2nd time or 3rd time occurs on chart as support i want to display it as buy ...how to do it plz ..hlep
Hey Sharan! That's a really complicated thing to achieve in Pine Script. If I get time once I've finished covering the basics I'll try to create a lesson on it
@@sharanrj5008 Hey Sharan! I'm currently in the process of creating a Pine Script Mastery Course that teaches everything I know about Pine :) hopefully it will be finished really soon. If you want to be notified when it's ready, you can sign up to the mailing list here : zenandtheartoftrading.com/advanced-pine-script-course Otherwise when I'm finished creating that course, I will go back to making free tutorial lessons here on RUclips, so stay tuned :)
when toggling between time frames, my chart shrinks in order to fit atr value at very bottom. Only way for smooth toggling between time frames is to disable atr which defeats the point. Any advice you can dish on how to fix this problem? thanks!
These lessons are amazing. I did run into a problem. (I copied the code verbatim) but when I add to the chart, it squishes the candles into a solid line. I'm not sure what I did wrong. Thx for any replies :)
Can you please help me how to get higher time ATR value on lower time frames charts. Example: I want Daily ATR value same on 5 minutes and 30 minutes charts
Hey UnBreakable! Absolutely, I'm working on that right now which is why I've been absent from RUclips. So far I have 3 hours of lessons recorded and I'm only half way through the list of course material to create :) I'll let you know on this channel when it's completed so stay tuned!
Hi, sorry for my bad english... I'm from Brazil and my name is Doug. Me and my brother are trying to write a trailing stop loss on Tradingview (pine script) and we're being successful. Our idea is to reach a specific profit target and change the stop loss, for example: 1- When my profit reaches 5% my stop loss will be 0% 2- When my profit reaches 10% my stop loss will be 5% 3- When my profit reaches 20% my stop loss will be 10% 4- Etc... Etc... Etc... I don't know if you could understand my idea, but that's what we're trying to do but we're not getting it. Could you kindly help us? Best regards my friend.
Hi, It look good, BUT ! It does not work (I think). Stop losses need to trigger, this one is just adjusting it to go lower. It is not possible to get stopped out, so IMO, useless, unless I am really doing something wrong, please correct me then.
Hi Gert! Yes this indicator is intended to be used on each bar. So you identify the bar you want to trail your stop above/below and then use that value. You don't adjust it on every single bar, only swing lows or highs
Another really amazing lesson.
Very well explained, so as a noob I'm having no issue following what you are saying.
Seriously Matt, thank you very much for your efforts!
You're welcome my friend! I'm glad you're enjoying the lessons :) plenty more on the way!
@@TheArtOfTrading :) I'm looking forward to them almost as much as I am looking forward to having a keyboard with 2 working shift keys....gods I can't wait to have 2 working shift keys again :P
@@faenorsjewel5618 hahaha yeah I feel you! I spilled a drink all over my keyboard last night while I was doing some editing and now mine is playing up too 🙁
i very rarely comment on anything but this is is a truly OUTSTANDING introduction, understands you have to walk before running
Only suggestion is when starting a script put a few blank lines at end and type above these...in the middle of the text pane... so that when people pause the RUclips progress/volume bar is not in the way
Which reminds me I should log on and complete the course
Your videos are nothing less than phenomenal......you deserve more subscribers and more views!
The best way for teaching is to build more complex ideas on a simpler one, step by step, thank you.
Really good. Just like my C++ instructor you remind me of him so much. Love that you give uses for the code when you explain it. Really help me have a basis for creating my own scripts.
Hi Matthew! First of all want to really thank u for your vids. They are amazing and u r an awesome tutor! For someone with zero coding experience (and frankly dislike/fear), u have made the videos and lessons surprisingly well-taught and enjoyable. have loved each one of your lessons so far and am sure gonna enjoy the others as well equally.
Very well explained, stop loss and take profit are a very important indicator, thank you very much.
Hey Matt, I searched all over for a tutorial on writing a Trailing Stoploss based on price reached. All I could find including in your channel is ATR or Percentage based Trailing Stoploss. My script takes Inputs of Pips for Stoploss and RR for Profit. I would like to move my Stoploss to Breakeven when a trade reaches 1.5R Profit and then move it to 1R when a trade reaches 2R Profit. Simple and Fixed values.
even for a experienced coder, this is awesome save me a lot of time and some trading tips as well go along
Amazing lessons , great tutorial.
Awesome. So much easy to understand. I'm at 7 th lesson. Looking for strategy based learning. Hope it will come ahead.
Thanks for your efforts and hardwork.
You're lessons are the clearest i've seen. Thank you
This stuff is great. Thanks so much for these great videos. I'm already getting a clear idea of how I'm going to master backtesting.
Superb! Had to watch several times to make sure I got the maths behind it, but finally got it.
Really well explained, love that you explain in simple terms bit by bit what each line of code is doing and why. Its key to learning. Also seeing it explained on the chart as we go, that's great too.
I think the transparency code is outdated now in v5 (I got an orange message about it at the bottom), so for anyone that may be looking for what seems like the new way? I used this - plot(atr, title="ATR", color=color.new(color.blue, 100))
Did u get the new code in v5?
Great Video! You are a wonderful mentor! Keep up the great work!
Your lessons are ACE!
Thank you so much
Its very practical. like some of comments below i rarely left comments but your demonstration is amazing that's easy to understand for everyone. BTW I also love your voice and accent as well as your ending words " trade green and good luck with your coding" Haha
Thanks so much for the feedback, Eric! I'm glad you've found these tutorials helpful :)
really great lesson .. Hope you will so more of that. GREAT.
This stuff is amazing man! Keep it up! Already registered for your course :)
Thanks for teaching and guiding Us, Great Works!!
You are my hero~~~!!!!
Thank you so much for this amazing video really.
Thanks for wonderful tutorial please continue good work n spread knowledge
Thanks so much!
Great lessons , great explained so i say thank u all the way from ISRAEL
thank yoiu very much for freely learning us.
Excellent course
Thanks Bomboora! More is on the way :)
Thank you for these fantastic lessons
Another great tutorial. Thank you
this is excellent, thank you for creating the videos
Absolutely fabulous! Thx mate. Subscribed immediately! Would even be sper fabulous if you could connect it to automatically adjust your stop-limit order. That would me smashing!
cheers, this is great.. I might be able to create my own alerts soon.. excellent..
Thanks for this, great video ! Got a question, when I make a strategy, and set STOP LOSS or TAKE PROFIT, based on ATR, for obvious reasons it never gets hit, because it is dynamic. How can I set a stop Loss or a Take Profit based on ATR or BB, but keep it fixed as a historic value ? Quick example: the Price now is 10.000, and the upper BB value is 10200 and the lower is 9800. I want set a Short trade with STOP LOSS on 10200 and a Take profit at = current price - (stop loss - current price) * 2 . What gives us 9600.
awesome series thank you
thank you so much this is exactly what i was looking for , keep up the good work
Nice one. Much love to you bro
thanks alot man, I appreciate your videos
You have not written a code for trailing stop loss (ATR) but you have created a code to calculate a lower and upper band (with a multiplier) starting from the ATR. Good explanation, but the code to contextualize the content with the title is missing.
The idea behind this indicator is to trail your stop loss based on where you entered your position (eg., if you entered long, then you trail your stop loss higher as the trailing ATR moves higher, and you ignore times when it dips, until you're stopped out. That's how I use it anyway).
In order to code an actual trailing stop indicator, you need to tell Pine when and where you entered your position, which is much more complex.
I think you might find this lesson more useful if that's what you're trying to do: ruclips.net/video/WM8qOjKimUk/видео.html
@@TheArtOfTrading I'm happy with the quick response to my comment, I'm glad. Anyway, I don't write the code in Pine but on python so I was just interested in understanding the logic of the code and then rewriting it myself. The point is that the cumulative maximum (or cumulative minimum if short) condition is missing. Of course, as you say then the entry point influences the volatility and therefore the distance of the stop loss from the price series, but all I wanted to say was that this very trivial condition was missing to make it a real trailing stop loss code. Thanks anyway for the explanation in the video which remains exhaustive;)
Thanks math great work
Does this work in version 5?
Or what we should to change in version 5 ?
And thanks
Thank you so much. Truly appreciate your effort. Thanks again.
Thank You for these tutorials! :) :) :)
Hello, I love your videos! Is it possible to implement this type of trailing stop into pineconnector?
Absolutely interesting! Thanks a lot
Nice video. Is it possible to do a presentation on plotting alternate trailing stops for short and long rather than plotting both the lines simultaneously?
Great course! Thank you for these videos.
I'm a really no-tech guy, so maybe you could help me. How to use this ATR TP and SL in backtesting the strategy?
I can't come up with any working code that would set up my exit at either ATR TP or ATR SL when the ATR should be based on a candle that I enter the trade.
Hope it's understandable :D Do you have any ideas?
Hello Marcin. I know it's quite some time ago but did you manage to get the code working for the above mentioned backtesting system? I'm in search for the exact code.
great, but how to add the ATR to the strategy.exit functions so we can see what the back test results are?
hey bro question is it possible to used stop Loss moved automatically adjust/moved using PaperTrading ,same as u've done on OANDA Autoview thnx 4 ur time Keep Safe i've enjoy ur Free Lesson Keep it Up i've Learn alot
one thing though, the price will never fall below the stop unless you are looking at the stoploss indicator yesterday. So, how do we move the graph, so we can see it break through?
another question , can we put our stop loss under the entry candle by 2% for example and the target will be the same R/R 1?
Is it possible to have write a script that has indicators on the top, such as Moving average and Bollinger Band along with indicators on the bottom such as ADX and TSI? Going off the videos I've seen the overlay function only allows one or the other with the True/False setting.
Hey buddy, that's an awesome tutorial. I have been searching for something like this for long time. Just found your channel today and i want to make a personnel request. can you please make a video on how to create an alert on tradingview using short or long trailing stop combined with another indicator into one single code ? For example, an alert when short trailing stop is crossing the 200 EMA in one single code.
This is fantastic.
Het Mathew, great stuff as always. one question: on minute 18.00 how do you plot these dashes for stop loss and take profit? I have tried using stepline, yet it still connects the trailing line: plot(longstop, title= "long trail stop", style=plot.style_stepline, color=color.new(color.silver,60))
Good video. But here the trailing Stop should be calculated till previous day close. Otherwise we will never have price crossovers as the trailing Stop will always be lower than the current close price..
If I am in a long is there a way to get the trailing stop to find the highest high of that trend regardless if it was 3 bars back, 7 bars back or 50 bars back? Like as long as I'm in a long position, use the highest high you find to calculate the trailing stop with the ATR? I'd like to be able to not get out of obvious trends because of a small pull back.
you are the man!
whats the purpose of bullion. can we plot directly plot(lowest(low,lookback), color=color.green) ...) without using use structure
great lessons :up
Thanks brother! I appreciate that :)
have been watching all your tutorials. Could you make a video for algo trading with Tradingview pine script? There are autoview with pink and Algostudio out there that can make pine script automated but do not know how to proceed
Hey Ching! That's on the list, when I finish my Pine Script Mastery Course I'll do a short guide on 3rd party API functionality :)
@@TheArtOfTrading something in python?
the script I am modifying was made in 2017, it seems there is an incompatibility of some sort - when I put in // @version=4
then it does not get compiled at the end
How can I change the strategy tester to only show trades for one trading day ?
thank you for the video! Im having struggle to keep the ATR value at the entry price, I would like to take profit at 1.5 * atr of my entry price and not "trailing" how can i do that?
Good lesson man, though for the plot(atr) line 18. Why would we bother changing the transparency to 100? Wouldn't it be simpler to just remove that line entirely?
Can we get buy and sell signal like supertrend indicator for any indicator???
If yes how?
Awesome video.... I'm checking out your site also. I need to do a pine script for a sma/ema crossover exit strategy.
what is the lesson that teach how to plot target et stop loss please?
Thanks a lot for the video guy.
I have a question, Is there any way we can plot the atr in a new pane while overlay is set to true but still want the trailing stop to be plotted on the price chart?
Really amazing Lesson,
My self Ravi from INDIA
Can you please make a lesson on increased Volume's High or Low gone by price, then it give signals
One more thing can you please make a lesson video on RSI BreakOut Signals, it would be really appreciate, Thank u so much.
damn this helped me out so much! thanks for this! i'm having a lil problem with the auto scale function when i plot this indicator to the screen.
It wants to show 0 on the BTC chart which makes all my candles squeezed together. any way i can fix this?
i found out the reason is this line:
plot(atr, color=color.blue, title="ATR", transp=100)
Hi,
Really amazing lesson, Very well explained. Can I get codes that you are showing as lesson 1-2-3?
That will be really helpful ! TIA
lets take stock price is 100 and it has support and resistance at 98 and 102 for the 23-march -2020..
now this support and Resistance i.e 98 and 102 =x
how to check this x is equal to previous any same support and Resistance
suppose previous 98 cames as support two times and now on 23 march this 3 rd time
when 2nd time or 3rd time occurs on chart as support i want to display it as buy ...how to do it plz ..hlep
Hey Sharan! That's a really complicated thing to achieve in Pine Script. If I get time once I've finished covering the basics I'll try to create a lesson on it
@@TheArtOfTrading k sir ..try to create evrything about pine script it will be very helpful ..and thanks
@@sharanrj5008 Hey Sharan! I'm currently in the process of creating a Pine Script Mastery Course that teaches everything I know about Pine :) hopefully it will be finished really soon. If you want to be notified when it's ready, you can sign up to the mailing list here : zenandtheartoftrading.com/advanced-pine-script-course
Otherwise when I'm finished creating that course, I will go back to making free tutorial lessons here on RUclips, so stay tuned :)
when toggling between time frames, my chart shrinks in order to fit atr value at very bottom. Only way for smooth toggling between time frames is to disable atr which defeats the point. Any advice you can dish on how to fix this problem? thanks!
any update on this for version 5? thank you in advance.
hoping u can do a script that can filter on a valid setup using art trailing-stop many tnx looking forward 4 that video
These lessons are amazing. I did run into a problem. (I copied the code verbatim) but when I add to the chart, it squishes the candles into a solid line. I'm not sure what I did wrong. Thx for any replies :)
13:50 found the solution.... :) Thx
why did we use usestructure boolean, can we make this indicator without use structure
Really amazing thanks!!!
Matt do you have a video to do something like DMI + Stoch are in the same OB/OS?
Can you please help me how to get higher time ATR value on lower time frames charts. Example: I want Daily ATR value same on 5 minutes and 30 minutes charts
How do I work with more than 2 if statements?
Amazing ty :)
when we can get your crash course about scripting by pine script ?
Hey UnBreakable! Absolutely, I'm working on that right now which is why I've been absent from RUclips. So far I have 3 hours of lessons recorded and I'm only half way through the list of course material to create :) I'll let you know on this channel when it's completed so stay tuned!
thanks awesome
How to use ATR Trailing stop loss in other live strategy ?
thanks
hai i have plotsahpe for cci crossover ema, can you show me how to plot below -100 line to zero line. -100
how to merge two or more indicator
looks like trading veiw is removing the 'transp' function , now they recommend using color.new() or color.rgb()
I dont understand how this would ever get triggered...? it never crosses the price when done like this..? what am i missing?
But price never triggers the stop, so whats the point?
hii... i want full course
Hi, sorry for my bad english... I'm from Brazil and my name is Doug.
Me and my brother are trying to write a trailing stop loss on Tradingview (pine script) and we're being successful.
Our idea is to reach a specific profit target and change the stop loss, for example:
1- When my profit reaches 5% my stop loss will be 0%
2- When my profit reaches 10% my stop loss will be 5%
3- When my profit reaches 20% my stop loss will be 10%
4- Etc... Etc... Etc...
I don't know if you could understand my idea, but that's what we're trying to do but we're not getting it.
Could you kindly help us?
Best regards my friend.
Sir please share a simple script for plot atr and ema in a single indicator window
Hi,
It look good, BUT ! It does not work (I think). Stop losses need to trigger, this one is just adjusting it to go lower. It is not possible to get stopped out, so IMO, useless, unless I am really doing something wrong, please correct me then.
Hi Gert! Yes this indicator is intended to be used on each bar. So you identify the bar you want to trail your stop above/below and then use that value. You don't adjust it on every single bar, only swing lows or highs
how do you join this mans discord
the atr value isnt the same as ATR built in.
This is not a trailing stop. It's a fixed stop that you turn on relative to ATR value.