*SOURCE CODE:* courses.theartoftrading.com/pages/a-simple-pullback-strategy-in-pine-script *JOIN MY MAILING LIST TO BE NOTIFIED OF NEW VIDEOS:* theartoftrading.com/
Hey! How can I iterate the value of the moving average using for loop and print the profit on each iteration of the moving average? Because I noticed that tweaking the values of the 2 moving averages can have better results. Thanks!
Can't say enough about how I personally love this new series! There are already tons of channels showcasing strategies as well as how to code using PINE, but to combine these two into one single series while taking people through your awesome thinking process is a true rare gem! There will be a lot of value in this for sure. Double thumbs up!! :D
As an adult who never learned coding when I should have, your videos have been a godsend. I just recently finished the free basics course and I will be signing up for the mastery course. I saw one video on your YT page involved Python. I've recently started a beginners Python course as well, and let me just say, I would also pay for a Python course from you, if you ever get to producing it.
Beautiful. The way you have applied the strategy's logic is the lesson here. I could have easily coded that strategy, but it would have been 10 times more messy and considerably less efficient. It's given me huge pointers to how to go forward.
Brilliant, mate. I have been Pinescripting for about a year but mostly just indicators so strategies and discussion on how you think through risk management, pyramiding, etc, and using them with exchanges is just awesome. Despite how simple this one was it was great to watch because not so long ago it would have been meaningless to me but these days every bit of code made sense. And that's a testament to the great community and to many of your videos. Thanks!
Awesome video there thank you. The way that I will improve it is by ditching percentage based and replace it with SL atr Multiplier so it can work on any market .. also add a close condition when the candle close under the 10 ema after it have been over , reduce capital until I'm comfortable with drawdown percentage, also add filter to stop entering market when the price is too far from the 200MA (% or atr based)
I slightly changed the strategy you used as an example and back tested on EURUSD (76 trades from 7/8/20 to 2/7/23) and USDJPY (73 trades over the same time frame) and the results were pretty good. USDJPY risking 1 percent per trade with a 1.1 RR yielded 30.52% profit with a 68.49% win rate. EURUSD yielded 24.14% profit with a 64.47% win rate. All I changed was I added an ATR (14 RMA) and did 1x the ATR value for my stop loss. So rules were: For Long entry. Price must close below the 10 ema, enter on the open of the next candle. Use 1x the ATR for the stop loss and 1.1 RR for TP. Opposite for shorts Now 70ish trades over 3 years might not seem like much but if you are trading both pairs thats around 150 trades, I also plan to back test on the other major currency pairs and if they yield the same results, you have yourself a completely mechanical strategy with a high win rate and regular set ups. Would take all of 10 minutes at the end of each daily candle to sit down and glance over your forex pairs and set up your positions and require zero thought. In case anyone was looking for a good strategy foundation, this is a good one
I expect this is going to be a great series. It's nice to see your code because, even though I think I'd be able to code this, what you write is usually a lot more elegant than what I come up with, so I can learn something from it. If you take suggestions for future videos in this series, I think Raschke's and Connors ' Holy Grail' strategy described in the book 'Street Smarts' fits in well with strategies you're looking for. It requires: 1. ADX > 30 2. Retracement to the 20 EMA 3. After the retracement a buy stop over the high of the previous bar 4. The SL goes at the most recent swing low and the PT at the most recent swing high (though you can also trail your stop). 5. Also you can reenter the trade at the original price if stopped out.
Thanks Janus! I appreciate the suggestion, it's hard to find simple rules-based strategies that are worth testing so I'll add that to my list to investigate in the future :)
Thank you so much. This is priceless. I watched your Pine script tutorial a little, went to your website to check your paid content, thought it was too much (I am in India, so ...), but now having watched this, I will at least subscribe to the Pine Script Mastery course. Your style is awesome.
Interesting idea for a series! I would like to add a challenge: how about using the same strategy on multiple timeframes (simultaneously) to achieve higher hit rate?
Love that my friend, thanks a lot! By the way at 18:05 i think it should be (buy price-close)/buy price instead of(buy price-close)/close, as we are calculating the percentage away from our buy price and not the close. Thanks again:)
Amazing! Thank you so much for doing this series. Does anyone have thoughts on selling 2-week out put credit spreads on the long signals and closing on the close signals?
Interesting! Any possibility that you can share the script example from a video like this as a downloadable text/script through a specific link, so we can "play" with it after watching the video? Thanks!
Hi What are the options for encrypting custom alert/syntax for signals that you can use with pineconnector and the other similar services to protect your BUY / SELL / EXIT LOGIC?
thanks for your video , it's really help me understand how to use pine script more flexible and also give me a mindset how to write my own strategy and optimize it
THIS, is the reason I came here to learn code, to take ideas ppl have and code them into a strategy tester. I find it so incredibly hard to code though, the info will not stick, have to watch and do 6 times just to understand it (coding is not something I like). But similar to you I loved making macros for botting in games, but unlike you I find coding not the same and it bores the hell out of me but I understand how useful and needed it is for testing. So I soldier on. That was a long winded way of me saying, this is exactly what I was looking for lol. Thanks mate!
At 18:05, shouldn't it be "((buyPrice - close) / buyPrice)" to calculate the percentual loss instead of "((buyPrice - close) / close)" ? Kind regards! I'm eager to learn, so I'm really looking forward to your reply!
Superb video, love the strategy videos - not so much how to trade or strat ideas, but how we can code our strategies. Would love to see more tutorials on building a strategy template or building a strategy script from the ground up with the most commonly used and important parts explained. Thanks
One other factor to consider, when comparing this strategy vs. buy and hold, is taxes. Short term capital gains will likely seriously affect the final outcome.
Super video on how to write and test Pinescript. When executing it on the 26th of Aug 2024, I got a massive loss until I switched from "Heikin Ashi" to "normal" candles. And when comparing this year's performance of about 18,5% of the S&P500 the 5,49% of the script is quite disappointing. So, I agree with the summary of the video is an example of how to implement a strategy in Pinescript but not a good strategy overall.
love this new series!!! hope we get new uploads of this series on a weekly basis! would love to see more scalping ideas on 3, 5, 15 mins chart rather than swings on daily chart
Cheers donYXD! Weekly is a bit difficult as it takes me several days to vet and test strategies I find and to code out the script etc., and I don't trade timeframes lower than the 4HR chart due to a multitude of problems with liquidity/slippage/commission costs/high spreads/lack of historical data to test on etc. so I'm not particularly experienced at scalping. But if I find a strategy that seems robust and has a genuine edge I'll definitely explore it!
Hey mate, thanks for a lot of free videos. If you add minimum commission in each strategy. It will help a lot of newbies not indulge into something which shows prospects of profit BUT the moment we enter the commission % it is shows entirely a different result. Thanks. Hope you understand the request. Cheers!😊
Curious how, between 1995 and 2018, the strategy of "Buy when price closes above 200 day sma, sell when it closes below 200 day sma" would fare against these two strategies
Nice video. Thanks! I would like to use different indicators or study of the tradingview database to wright a strategy by using a combination of them. Can give me a hint, how to start? Thanks in advance!
on one minute time frame, as of right now, if you go with MA1 as 141 or 270 and MA2 as 20 without ticking the exit on lower close, you can get to around 80-81% profitability per trade, makes your net profit higher and if you keep it that way, it reduces the lag between realized profits if i can express myself so. you get around 190 trades and 8 candles per average which is great, because it will read the performance for less than a day, which is what you'd normally want. and my net profit percentage is 2.48% strangely enough here, if you play with different numbers for starting capital you will get different percentage gain which is weird, the lowest one that was similar to automatically set 50k was 4,333 everything else tends to lower the profit percentage number
Very educational 👌 Using some of your older tuts, i made a multiple close to wch ever is more profitable. Maybe it can be applied also to this. Im learning from you. Thank you so much
Hi I'm getting a Syntax error at input 'strategy' pointing to the line with the buyCondition conditional as below: stopDistance = strategy.position_size > 0 ? ((buyPrice - close)/ close) : na stopPrice = strategy.position_size > 0 ? buyPrice - (buyPrice * i_StopPercent) : na stopCondition = strategy.position_size > 0 and stopDistance > i_StopPercent // Enter positions if buyCondition strategy.entry(id="Long", direction=strategy.long) Yes there is a tab in the block following if, not sure what it wants, any ideas?
hey massive thanks for this guidance video... was super detailed and helpful... just one query though: sometimes the buyconditions are met but TV still doesnt generate a buy signal... any clue why that might be happening?
Nice video thanks! I think the script would benefit from a direction check of the moving average. If it trends up i would take a long and if it goes down take a short.
What type of candlestick chart are you using? Coz the open of current candle and open of previous candle don't seem to equal in many cases. It might be noob question, but I'm new to all this and would be helpful to know.
First of all, you're great. But when you take the number of trading days in 13 years and the number of trades executed into account, is it necessary to trade by script?
Amezing video and I really appreciate your way of teaching. I am new to pine getting better every day. What I have not found yet is how to mix indicator I wrote (programmer) with a strategy. In your example you did the Indicator and the strategy stuff. Now let's say I build an indicator telling when to go in or out. My question is how do I access it from the strategy similar to sma() for example which arrived with tradingview.
Interesting. One other thing I noticed was that many of the losing trades were taken when the slope of the two averages disagreed. I'm curios to see how taking only the trades when the slope of the two averages was up would do.
There is a way to prevent cascade of buys after being hit by stop loss? Because the subsequent buys don´t meet the criteria and creates a series of loosing buys. This fix could make this a perfect code.
Amazing series learning so much from it! One small tweak could eliminate a some of the negative trades, if the Open price on the buy order is under the 200sma do not take trade. I am trying to add this in but cant figure out how to do it is it possible to add this small condition?
Hi, Thanks for sharing your valuable content. would you plz consider making a video about how to set an Alarm on multiple Symbols at once in a simple script for example crossing MA !!?
A question about max draw down,, holding you would have 50% but lose nothing if you hold through it, with the strategy thee draw down is capped at 10%, it could hit that max many times over, how many times is the max of 10% hit
The max drawdown is the worst drawdown the system experienced, so if a strategy has a max drawdown of 10% then it means the most it ever lost as a percentage of capital during its worst losing period was 10%. This is a massively boosted risk-adjusted return compared to a 50% drawdown, while it's true that you don't realize a loss until you click the sell button, a 50% drawdown could take many years to recover. Whereas multiple 10% drawdowns might only take a few months, meaning you can reach new equity highs far more frequently and generate far more profit over the long-term than buying and holding through big drawdowns. (Speaking from experience) Also, most investors would get nervous and sell at some point on the way down if they encountered a -50% drawdown, unless they had the courage (or maybe recklessness) to never ever check their trading account
I wonder what the results were if you included the short side, or a modified short condition to take profits earlier (given that SPY is overall bullish long-term).
I ran into a small problem. I'm trying to write a line of code that will measure the body of a candle and mark of candles equal to or larger than 5 pips. If it's not too much on you could you help me out? Please?
34:14 I think it's not that easy to just negate that rule in sellCondition, because then your current entry could get closed very quickly if it closes below the recent low. We probably still want to get price at least once above ma2 before allowing sellCondition to be true. Therefore a new boolean variable could be introduced which gets true if high or close gets above ma2 after a new entry has been started and which then can be used instead of the 'close > ma2' part in sellCondition.
im now starting to learn pine script and investing, looks very interesting, but is it doing in real life? is it working as the strategy tester?do we have any real life results?
Excellent video. As usual, your explanationations are very well done. I have a question, do you have a similar pine script for the short strategy. I tried to modify this script but was not able to. Can you help me or show me how I can do this?
Any way you can publish the script for us to look at? I'm sure I've stuffed something up while following along (ie. strategy goes long at the start of the time period and never closes) but not sure where.
I like the idea of this series... But you absolutely MUST include fees/commissions and slippage in the strategy tester results... So many strategies on Trading View look very good - until you add in fees and slippage... Without those, strategies are very misleading.
Hi David, I did include commissions in this strategy script (0.005 USD per contract which is what I get through Interactive Brokers) and slippage is difficult to simulate on stocks, but SPY is pretty liquid so slippage on this particular strategy wouldn't be a major factor. But I agree with you and will continue to stress the importance of these factors in future strategy breakdowns especially on markets or strategies that are particularly vulnerable to these factors :)
strategy must have max drawdown 10% to be eligible to build a trading bot on it, keep improving. i have a pine strategy with 5% drawdown and >200% return per year. you have a long way to go
Good point! What timeframe are you using (length of the bar)? 1 minute, 30 seconds...? What's the Sharpe ratio of your strategy? How many trades per year?
Nice video. What Im struggling to get my head round is if the win rate is 75% we make 0.44% 75 times in 100, but lose 10% 25 times in a hundred? OR am i misunderstanding in that the overall average including losses is 0.44%
I've noticed for every strategy script I have looked at so far, when I adjust things like ema length the data changes (as it should) but when I adjust the stop loss and take profit values the results stay the same ! So to me this makes the strat tester totally useless. Any ideas ?
*SOURCE CODE:* courses.theartoftrading.com/pages/a-simple-pullback-strategy-in-pine-script
*JOIN MY MAILING LIST TO BE NOTIFIED OF NEW VIDEOS:* theartoftrading.com/
Hey! How can I iterate the value of the moving average using for loop and print the profit on each iteration of the moving average? Because I noticed that tweaking the values of the 2 moving averages can have better results. Thanks!
thx, sounds like a mix between pullback and mean reversion, no?
does the signal trigger a real order?
The source code link above does not work. Is there another link? Thanks
@@golferboggie link works here. u may wanna check your system.
Can't say enough about how I personally love this new series! There are already tons of channels showcasing strategies as well as how to code using PINE, but to combine these two into one single series while taking people through your awesome thinking process is a true rare gem! There will be a lot of value in this for sure. Double thumbs up!! :D
@@khanra17 stopPrice is only used for plotting the red line.
This video helped me. It covers key Pine Script syntax quickly while explaining other trading concepts. It will not waste your time.
As an adult who never learned coding when I should have, your videos have been a godsend. I just recently finished the free basics course and I will be signing up for the mastery course. I saw one video on your YT page involved Python. I've recently started a beginners Python course as well, and let me just say, I would also pay for a Python course from you, if you ever get to producing it.
Beautiful.
The way you have applied the strategy's logic is the lesson here. I could have easily coded that strategy, but it would have been 10 times more messy and considerably less efficient. It's given me huge pointers to how to go forward.
Brilliant, mate. I have been Pinescripting for about a year but mostly just indicators so strategies and discussion on how you think through risk management, pyramiding, etc, and using them with exchanges is just awesome. Despite how simple this one was it was great to watch because not so long ago it would have been meaningless to me but these days every bit of code made sense. And that's a testament to the great community and to many of your videos. Thanks!
That's awesome B Boy! Really glad to hear it, keep up the great work and good luck with your trading :)
Started doing my first pine coding today. It took me a while to get this to work, but I managed to get through it and see a result.
Awesome video there thank you. The way that I will improve it is by ditching percentage based and replace it with SL atr Multiplier so it can work on any market .. also add a close condition when the candle close under the 10 ema after it have been over , reduce capital until I'm comfortable with drawdown percentage, also add filter to stop entering market when the price is too far from the 200MA (% or atr based)
I slightly changed the strategy you used as an example and back tested on EURUSD (76 trades from 7/8/20 to 2/7/23) and USDJPY (73 trades over the same time frame) and the results were pretty good. USDJPY risking 1 percent per trade with a 1.1 RR yielded 30.52% profit with a 68.49% win rate. EURUSD yielded 24.14% profit with a 64.47% win rate. All I changed was I added an ATR (14 RMA) and did 1x the ATR value for my stop loss. So rules were:
For Long entry. Price must close below the 10 ema, enter on the open of the next candle. Use 1x the ATR for the stop loss and 1.1 RR for TP. Opposite for shorts
Now 70ish trades over 3 years might not seem like much but if you are trading both pairs thats around 150 trades, I also plan to back test on the other major currency pairs and if they yield the same results, you have yourself a completely mechanical strategy with a high win rate and regular set ups. Would take all of 10 minutes at the end of each daily candle to sit down and glance over your forex pairs and set up your positions and require zero thought. In case anyone was looking for a good strategy foundation, this is a good one
How's the trading been going? Always looking for good advice if you would like to share more on your strategy
how has it went this year?
I expect this is going to be a great series. It's nice to see your code because, even though I think I'd be able to code this, what you write is usually a lot more elegant than what I come up with, so I can learn something from it. If you take suggestions for future videos in this series, I think Raschke's and Connors ' Holy Grail' strategy described in the book 'Street Smarts' fits in well with strategies you're looking for. It requires:
1. ADX > 30
2. Retracement to the 20 EMA
3. After the retracement a buy stop over the high of the previous bar
4. The SL goes at the most recent swing low and the PT at the most recent swing high (though you can also trail your stop).
5. Also you can reenter the trade at the original price if stopped out.
Thanks Janus! I appreciate the suggestion, it's hard to find simple rules-based strategies that are worth testing so I'll add that to my list to investigate in the future :)
Outsanding video. I will go back up to your first video and try to learn from scratch pine script strategies. Many thanks.
Thank you so much. This is priceless. I watched your Pine script tutorial a little, went to your website to check your paid content, thought it was too much (I am in India, so ...), but now having watched this, I will at least subscribe to the Pine Script Mastery course. Your style is awesome.
Interesting idea for a series! I would like to add a challenge: how about using the same strategy on multiple timeframes (simultaneously) to achieve higher hit rate?
just came across im a trader but never touched code and realised you done a basic one for free really looking forward to digging into this 😊
Thank you very much, I really appreciate that , God bless you and your family ❤❤❤
I want you to know that I subscribed to this channel exclusively because of the way that you corrected the *ABOVE* audio cut.
Also good video
Love that my friend, thanks a lot! By the way at 18:05 i think it should be (buy price-close)/buy price instead of(buy price-close)/close, as we are calculating the percentage away from our buy price and not the close. Thanks again:)
Always you proof that you are the best, thanks very much Mr.Matt, keep going...
Thank you for the detailed walk-through. Do you haver a video or resource showing how to get this PineScript Code into Think or Swim?
Amazing! Thank you so much for doing this series. Does anyone have thoughts on selling 2-week out put credit spreads on the long signals and closing on the close signals?
Interesting! Any possibility that you can share the script example from a video like this as a downloadable text/script through a specific link, so we can "play" with it after watching the video? Thanks!
Hi What are the options for encrypting custom alert/syntax for signals that you can use with pineconnector and the other similar services to protect your BUY / SELL / EXIT LOGIC?
thanks for your video , it's really help me understand how to use pine script more flexible and also give me a mindset how to write my own strategy and optimize it
THIS, is the reason I came here to learn code, to take ideas ppl have and code them into a strategy tester.
I find it so incredibly hard to code though, the info will not stick, have to watch and do 6 times just to understand it (coding is not something I like).
But similar to you I loved making macros for botting in games, but unlike you I find coding not the same and it bores the hell out of me but I understand how useful and needed it is for testing. So I soldier on.
That was a long winded way of me saying, this is exactly what I was looking for lol.
Thanks mate!
first time i watch one of your video,thank you for your work, you got a new subscriber buddy
At 18:05, shouldn't it be
"((buyPrice - close) / buyPrice)" to calculate the percentual loss instead of "((buyPrice - close) / close)" ?
Kind regards! I'm eager to learn, so I'm really looking forward to your reply!
Thank you so much. This is an amazing tutorial! Plesae do more Pine script strategy testing videos.
Excellent Trading Video Professor
EXCELLENT VIDEO, how can we set it up to work on 4H chart instead of 1 Day for example??
This lesson is amazing. Can't thank you enough for sharing your code. Thank you!
Awesome series!! Keep them coming. Greetings from South America.
Superb video, love the strategy videos - not so much how to trade or strat ideas, but how we can code our strategies. Would love to see more tutorials on building a strategy template or building a strategy script from the ground up with the most commonly used and important parts explained. Thanks
One other factor to consider, when comparing this strategy vs. buy and hold, is taxes. Short term capital gains will likely seriously affect the final outcome.
Would be interesting to see how a short version of this script would perform
I really enjoyed this. Thank you for your time and effort and looking forward to more strategy testings ;)
Super video on how to write and test Pinescript. When executing it on the 26th of Aug 2024, I got a massive loss until I switched from "Heikin Ashi" to "normal" candles. And when comparing this year's performance of about 18,5% of the S&P500 the 5,49% of the script is quite disappointing. So, I agree with the summary of the video is an example of how to implement a strategy in Pinescript but not a good strategy overall.
Really good! Thank you very much!
For a good strategy what should be max drawdown % and Sharpe ratio ?
love this new series!!!
hope we get new uploads of this series on a weekly basis!
would love to see more scalping ideas on 3, 5, 15 mins chart rather than swings on daily chart
Cheers donYXD! Weekly is a bit difficult as it takes me several days to vet and test strategies I find and to code out the script etc., and I don't trade timeframes lower than the 4HR chart due to a multitude of problems with liquidity/slippage/commission costs/high spreads/lack of historical data to test on etc. so I'm not particularly experienced at scalping. But if I find a strategy that seems robust and has a genuine edge I'll definitely explore it!
Thank you very much. Can you please create a video in how to code divergence between Price Action and RSI.
Hey mate, thanks for a lot of free videos.
If you add minimum commission in each strategy. It will help a lot of newbies not indulge into something which shows prospects of profit BUT the moment we enter the commission % it is shows entirely a different result. Thanks. Hope you understand the request. Cheers!😊
Sir this is awesome strategy video. Is it only applies to Daily timeframe or can be use any? Thanks... and more power!!!
you are so humble and your voice is so beautiful.
excellent video ... thanks for pulling this together and sharing with the community !! really looking fwrd to the coming videos!!
the source code can be used in jupyter notebook or google colab for parameter tuning ?
This is great thank you so much for this lesson.
I'm glad I found your channel, amazing! subbed and great to hear a fellow Aussie
Curious how, between 1995 and 2018, the strategy of "Buy when price closes above 200 day sma, sell when it closes below 200 day sma" would fare against these two strategies
Nice video. Thanks! I would like to use different indicators or study of the tradingview database to wright a strategy by using a combination of them. Can give me a hint, how to start? Thanks in advance!
Great video. Got a question is there a way to in tell script to enter a trade at certain time of day and exit ??
this pine editor strategy testing stuff is doing my head in! my strategy is kind complex to put in to code (as a non coder)
on one minute time frame, as of right now, if you go with MA1 as 141 or 270 and MA2 as 20
without ticking the exit on lower close, you can get to around 80-81% profitability per trade, makes your net profit higher and if you keep it that way, it reduces the lag between realized profits if i can express myself so. you get around 190 trades and 8 candles per average which is great, because it will read the performance for less than a day, which is what you'd normally want.
and my net profit percentage is 2.48%
strangely enough here, if you play with different numbers for starting capital you will get different percentage gain which is weird, the lowest one that was similar to automatically set 50k was 4,333 everything else tends to lower the profit percentage number
Did you ever update the code to adjust the stop loss, which you mention right at the end of the video? If so, how did this impact the results?
Excellent video, gives nice insight to pine.
This is really amazing. Thank you so much !!!
Thanks for sharing the code freely!
What code options are there to automatically move the stop loss to the entry point when the first take profit is reached ( when I use a multitakes) ?
Very educational 👌
Using some of your older tuts, i made a multiple close to wch ever is more profitable. Maybe it can be applied also to this.
Im learning from you. Thank you so much
Hi I'm getting a Syntax error at input 'strategy' pointing to the line with the buyCondition conditional as below:
stopDistance = strategy.position_size > 0 ? ((buyPrice - close)/ close) : na
stopPrice = strategy.position_size > 0 ? buyPrice - (buyPrice * i_StopPercent) : na
stopCondition = strategy.position_size > 0 and stopDistance > i_StopPercent
// Enter positions
if buyCondition
strategy.entry(id="Long", direction=strategy.long)
Yes there is a tab in the block following if, not sure what it wants, any ideas?
Hi. I had the same problem, It's the spaces after the if command.
these need to be exactly 4 spaces in...! wtf
hey massive thanks for this guidance video... was super detailed and helpful... just one query though: sometimes the buyconditions are met but TV still doesnt generate a buy signal... any clue why that might be happening?
Nice video thanks! I think the script would benefit from a direction check of the moving average. If it trends up i would take a long and if it goes down take a short.
very good excellent presentation
What type of candlestick chart are you using? Coz the open of current candle and open of previous candle don't seem to equal in many cases. It might be noob question, but I'm new to all this and would be helpful to know.
First of all, you're great. But when you take the number of trading days in 13 years and the number of trades executed into account, is it necessary to trade by script?
Amezing video and I really appreciate your way of teaching.
I am new to pine getting better every day.
What I have not found yet is how to mix indicator I wrote (programmer) with a strategy. In your example you did the Indicator and the strategy stuff.
Now let's say I build an indicator telling when to go in or out. My question is how do I access it from the strategy similar to sma() for example which arrived with tradingview.
Interesting. One other thing I noticed was that many of the losing trades were taken when the slope of the two averages disagreed. I'm curios to see how taking only the trades when the slope of the two averages was up would do.
Does this re-paint ??? Or i can trade directly 😊
That's a good question
There is a way to prevent cascade of buys after being hit by stop loss? Because the subsequent buys don´t meet the criteria and creates a series of loosing buys. This fix could make this a perfect code.
Amazing series learning so much from it! One small tweak could eliminate a some of the negative trades, if the Open price on the buy order is under the 200sma do not take trade. I am trying to add this in but cant figure out how to do it is it possible to add this small condition?
Hi, Thanks for sharing your valuable content. would you plz consider making a video about how to set an Alarm on multiple Symbols at once in a simple script for example crossing MA !!?
I learned a lot from this Video. Thank you!
A question about max draw down,, holding you would have 50% but lose nothing if you hold through it, with the strategy thee draw down is capped at 10%, it could hit that max many times over, how many times is the max of 10% hit
The max drawdown is the worst drawdown the system experienced, so if a strategy has a max drawdown of 10% then it means the most it ever lost as a percentage of capital during its worst losing period was 10%. This is a massively boosted risk-adjusted return compared to a 50% drawdown, while it's true that you don't realize a loss until you click the sell button, a 50% drawdown could take many years to recover. Whereas multiple 10% drawdowns might only take a few months, meaning you can reach new equity highs far more frequently and generate far more profit over the long-term than buying and holding through big drawdowns. (Speaking from experience)
Also, most investors would get nervous and sell at some point on the way down if they encountered a -50% drawdown, unless they had the courage (or maybe recklessness) to never ever check their trading account
100% i was thinking about the simple pine for this exact topic
How do I create a variable for the entry price + 100?
I wonder what the results were if you included the short side, or a modified short condition to take profits earlier (given that SPY is overall bullish long-term).
I ran into a small problem. I'm trying to write a line of code that will measure the body of a candle and mark of candles equal to or larger than 5 pips. If it's not too much on you could you help me out? Please?
Good job as always. Thanks alot
34:14 I think it's not that easy to just negate that rule in sellCondition, because then your current entry could get closed very quickly if it closes below the recent low.
We probably still want to get price at least once above ma2 before allowing sellCondition to be true.
Therefore a new boolean variable could be introduced which gets true if high or close gets above ma2 after a new entry has been started and which then can be used instead of the 'close > ma2' part in sellCondition.
im now starting to learn pine script and investing, looks very interesting, but is it doing in real life? is it working as the strategy tester?do we have any real life results?
Excellent video. As usual, your explanationations are very well done. I have a question, do you have a similar pine script for the short strategy. I tried to modify this script but was not able to. Can you help me or show me how I can do this?
Any way you can publish the script for us to look at? I'm sure I've stuffed something up while following along (ie. strategy goes long at the start of the time period and never closes) but not sure where.
ye tradingview looks so good but then the spread changes or doesnt account for bid and ask always seems to give mid price charts
Can you design a stock strategy that gives no more than 7 trades a day with a high win % rate and high profit factor? .....or is that too dificult?
I like the idea of this series... But you absolutely MUST include fees/commissions and slippage in the strategy tester results... So many strategies on Trading View look very good - until you add in fees and slippage... Without those, strategies are very misleading.
Hi, do you have youtube videos explain how to calculate the slippage and add to the strategies?
@@georgius163 Slippage isn't a set number, it depends on the market you're trading and its liquidity, and your own trading size.
Hi David, I did include commissions in this strategy script (0.005 USD per contract which is what I get through Interactive Brokers) and slippage is difficult to simulate on stocks, but SPY is pretty liquid so slippage on this particular strategy wouldn't be a major factor. But I agree with you and will continue to stress the importance of these factors in future strategy breakdowns especially on markets or strategies that are particularly vulnerable to these factors :)
Thank you very much. I like your video and the way you explain. Is there somewhere i can find the source code please ?
Sure! You're welcome, the link to the source code is in the description :)
You make this so easy to understand
Thank you..
How about an ABC trading strategy 😍
strategy must have max drawdown 10% to be eligible to build a trading bot on it, keep improving. i have a pine strategy with 5% drawdown and >200% return per year. you have a long way to go
Good point! What timeframe are you using (length of the bar)? 1 minute, 30 seconds...?
What's the Sharpe ratio of your strategy?
How many trades per year?
@@Morris_MK first bot uses TF10, 2 trades per day, TSLA. Second use another more volatile stock TF3, 2-4 trades per day
They won't respond cause they are full of crap.
3 weeks later and like I said, no response.
@@cryptoholica72 ask me what you want to know
Mismatched input 'end of line without line continuation' expecting ':'
thanks, your content is awesome
Good video.
interested in new ones!
very interesting, but why is my overlay is not working even if it is set to true?
Nice video.
What Im struggling to get my head round is if the win rate is 75% we make 0.44% 75 times in 100, but lose 10% 25 times in a hundred? OR am i misunderstanding in that the overall average including losses is 0.44%
how to place order with alerts automatically?, post some videos
Did anyone try running the code independently? What pairs/timeframes are you guys using?
Thank you. This looks great. I am going to convert this to ninjascript.
This is a unique UA-cam video, keep it up.
Can you make an indicator for Binary and Mt2 Trading that trades 5 minutes or 1 hour?
Joe should be proud of this video, he just gain my subscription:D
I've noticed for every strategy script I have looked at so far, when I adjust things like ema length the data changes (as it should) but when I adjust the stop loss and take profit values the results stay the same ! So to me this makes the strat tester totally useless. Any ideas ?
Can you please make your TradingView as light theme? Thats easy to see in mobile.