Hey Viny, if you're still interested in Pinescript, I wanted to let you know about a software I've created that automates the backtesting of strategies in thousands of different scenarios. Once you input your strategy into the software, it tests it on dozens of different assets and timeframes to see where it performs best. So, with just one command, you can backtest your strategy not only on one pair or commodity, but on dozens of them, including stocks, cryptocurrencies, and more. But the best part is that the software can also change the variables in your script. For example, it can find the perfect value for your stop loss and take profit in different scenarios or try dozens of different values for moving averages, MACD, RSI, ATR, Bollinger Bands, or any indicator you're using. The results are incredible because with just one command, you get thousands of different combinations for your strategy without having to do anything. And it's 100% safe that you'll find a setting that performs better than the one you were using by default. Why? Because every strategy can be fine-tuned by trying better values for the indicators, or because it's a strategy that doesn't work well on the asset you're using but performs great on another one, or it performs better on a different timeframe than the one you usually use. I'm also subscribed to TradingView's Premium plan, which allows me to backtest with all the data available on the platform, going back 50 years for daily candles and 22 years for 30-minute candles. If you want to check it out, I invite you to visit my Fiverr page. As I found you, I'll give you the first round for free, where I'll provide you with the results of your strategy in 100 different scenarios, and you'll immediately see how powerful it is. I always deliver a file with the raw data table and an Excel file with graphs and filters to quickly find the most performing strategies among the thousands tested. You can find me on Fiverr by searching for "I will automate thousands of backtests." If you see more than one person, look for the one with the username "codingtrading." Feel free to message me there, even just to give me your thoughts, as I'm new to the platform. Thanks a lot!
I just discovered your video, and it was very easy to understand. It was well-organized and clearly explained. I'm new to Pine scripting. so I'm saving this to my playlist. Thanks!
@@aldolabuonora I don't sorry. Might find someone upwork or freelancer if you search for pinescript. Alternatively there's a big public library you can use to search for a similarish strategy and try and contact the author who will understand it.
Excellent is the best word for this... now I learned pine script in about ten minutes....great job! Very interesting the last minutes how to create a javascript file for advanced doing...I ll read all on your site!
This is the first time I give a like, subscribe and leave a comment in a video, but this kind of information certainly deserves it. Truly amazing content!!! Thank you and keep up with the good work!
Hey man, if you're still interested in Pinescript, I wanted to let you know about a software I've created that automates the backtesting of strategies in thousands of different scenarios. Once you input your strategy into the software, it tests it on dozens of different assets and timeframes to see where it performs best. So, with just one command, you can backtest your strategy not only on one pair or commodity, but on dozens of them, including stocks, cryptocurrencies, and more. But the best part is that the software can also change the variables in your script. For example, it can find the perfect value for your stop loss and take profit in different scenarios or try dozens of different values for moving averages, MACD, RSI, ATR, Bollinger Bands, or any indicator you're using. The results are incredible because with just one command, you get thousands of different combinations for your strategy without having to do anything. And it's 100% safe that you'll find a setting that performs better than the one you were using by default. Why? Because every strategy can be fine-tuned by trying better values for the indicators, or because it's a strategy that doesn't work well on the asset you're using but performs great on another one, or it performs better on a different timeframe than the one you usually use. I'm also subscribed to TradingView's Premium plan, which allows me to backtest with all the data available on the platform, going back 50 years for daily candles and 22 years for 30-minute candles. If you want to check it out, I invite you to visit my Fiverr page. As I found you, I'll give you the first round for free, where I'll provide you with the results of your strategy in 100 different scenarios, and you'll immediately see how powerful it is. I always deliver a file with the raw data table and an Excel file with graphs and filters to quickly find the most performing strategies among the thousands tested. You can find me on Fiverr by searching for "I will automate thousands of backtests." If you see more than one person, look for the one with the username "codingtrading." Feel free to message me there, even just to give me your thoughts, as I'm new to the platform. Thanks a lot!
Awesome video. The chop is the problem. How to recognize it programmatically and switch strategy or at least stop trading is the question. Thank you for sharing your knowledge. excited to check out your other videos.
Recognising what stage the market is in and adjusting focus on mean reversion strategies in choppy conditions and trend following strategies when there is momentum. Things like volatility indexes and distance from long term moving averages can help alongside market sentiment checks.
Hey man, if you're interested in Pinescript, I wanted to let you know about a software I've created that automates the backtesting of strategies in thousands of different scenarios. Once you input your strategy into the software, it tests it on dozens of different assets and timeframes to see where it performs best. So, with just one command, you can backtest your strategy not only on one pair or commodity, but on dozens of them, including stocks, cryptocurrencies, and more. But the best part is that the software can also change the variables in your script. For example, it can find the perfect value for your stop loss and take profit in different scenarios or try dozens of different values for moving averages, MACD, RSI, ATR, Bollinger Bands, or any indicator you're using. The results are incredible because with just one command, you get thousands of different combinations for your strategy without having to do anything. And it's 100% safe that you'll find a setting that performs better than the one you were using by default. Why? Because every strategy can be fine-tuned by trying better values for the indicators, or because it's a strategy that doesn't work well on the asset you're using but performs great on another one, or it performs better on a different timeframe than the one you usually use. I'm also subscribed to TradingView's Premium plan, which allows me to backtest with all the data available on the platform, going back 50 years for daily candles and 22 years for 30-minute candles. If you want to check it out, I invite you to visit my Fiverr page. As I found you, I'll give you the first round for free, where I'll provide you with the results of your strategy in 100 different scenarios, and you'll immediately see how powerful it is. I always deliver a file with the raw data table and an Excel file with graphs and filters to quickly find the most performing strategies among the thousands tested. You can find me on Fiverr by searching for "I will automate thousands of backtests." If you see more than one person, look for the one with the username "codingtrading." Feel free to message me there, even just to give me your thoughts, as I'm new to the platform. Thanks a lot!
Hi James, thank you for the awesome content you put together. much respect for the way you presented and how all the concept you delivering come together at the end. Screen visual was not so good though, i hope you take it well for improvement. Overall, brilliant video. Thanks once again.
this has been very helpful, only thing I gotta say is maybe turn the white balance down cause it looks like you have a tanning and albino filter on at the same time
Thank you for the great video. However, I faced an issue at the beginning as I got an error "line 5: Could not find function or function reference 'study'."
Great intro. Thanks so much. I have experience with javascript , java , C , VB -What language do yo recommend I learn to code a forex bot connected to Pepperstone for example ?
I'm not familiar with Pepperstone but check the API and see what wrappers they have. Probably NodeJS using JavaScript would be a good choice as a simple scripting language. That's what I use so probably have a bias here. If you are doing very low time frame quant stuff where speed is essential then there might be some benefit to using C. Only other factor would be if you are looking at doing a lot of machine learning work in which python is normally the weapon of choice. Probably overcomplicating a simple question. My general recommendation would be JavaScript using NodeJS. Can run it locally to start with and then migrate to a server or microservice for production.
I generally start with them running locally because I'm breaking/tweaking things constantly and then once they are fairly stable I'll migrate them to a secure environment.
James, great video! Direct to the point, swift and not boring and useful! If we are to build our own server for live algo trading using python, which framework would you use? Backtrader, VectorQT...etc? (I am just a beginning willing to spend much time to learn. Just want to find the right direction to invest my learning hours)
If I was doing it I would just connect directly to the exchange api using rest or websockets. Each exchange is different but in crypto markets you can get data and post trades quite easily.
@@JamesBachini (williams Fractals) tredingview indicator's convert the signals of this pinscript into a script that gives signals one minute in advance
Hey, good evening! I am from another country, very poor! I found it very exciting to watch this video and everything else! I couldn't understand 100%, and I would like to know if it's possible to get this script somehow?
Hi James, many thanks for the lesson. One question can I using pine script monitor several symbols? Let's say I am looking 50 different assets: is there a way in pine script to get a alert for when any of those 50 papers cross a moving average for example... again many thanks
No the alerts are a bit intentionally awkward in my opinion. You would need to set one up every 3 months for each asset. I think there is a limit on the number of alerts you can have too based on your fee tier. I guess it's done this way to protect system resources but it makes it awkward to build out a custom screener/alert system like what you are after. I'd suggest if you want to do it get the data from somewhere else like Tiingo and set up a custom script with alerts on something like Twilio.
thanks for the tutorial. I'm new to this, and pasted your code into my Pine Editor, but when I tap 'Strategy Tester' I get a Caution message "This Strategy did not generate any orders throughout the testing range". I've checked every line but not sure why its not working for me. Would appreciate any tips on this :)
If you've tried it against multiple markets and timeframes I expect it's something to do with the condition where it opens the trade. Hard to advise more but you could probably put it into chatGPT and ask why isn't this taking any trades
It really depends on the situation and volatility of the traded asset. In theory it will work with stocks but you may want to fit the moving average to the data and backtest each stock individually.
thanks for the video James, I'm new to this and want to modify an existing indicator on Tradingview but not quite sure how to do it. Specifically, I want to use the existing Stochastic Momentum Index to get the same alerts on crossings of SMI & SMI-based EMA but add a condition to get those alerts only when crossing happens in the oversold or overbought region. Do you know how I can add this condition? Should the pine code be changed from indicator to study or strategy and rewritten or is there an easier way to modify it? thanks
You could maybe use something simple like RSI to check if it's overbought or oversold and add a condition for that when popping the alert? Combine it with something like this www.google.com/amp/s/zenandtheartoftrading.com/pinescript/generate-trading-signals-with-rsi/%3famp
Great tutorial. How can we define the position size (cash) which is variable value for each order? when i try this, it calculates different size: strategy(title="xxx", overlay=true, initial_capital=1000, default_qty_type=strategy.cash, default_qty_value=1) strategy.entry("Long", strategy.long, when=long_condition, qty=position_size) the "position_size" is a float value which i calculated with risk management.
@@JamesBachini I got it. "calc_on_every_tick=false" makes the differance between my qty and realtime qty 😁. When it's true, the calcs are ok. Thanks for the reply
yeah it's quite simple to do you just use an if statement with multiple checks if (ta.ema(source, length) and ta.rsi(source, length)) { // do whatever here } Something like that I think from memory. Or you might need to do it like FilterOK = false Filter1 = close > open Filter2 = rising(volume,1) FilterOK := Filter1 and Filter2
James is there anyway to set up an alert for all stocks that meet a specific crossover ? Example if apple 20 crosses the 100 ema then i would automatically get an alert. But i want if for all stocks this happen for not just one stock. Any idea? Thanks in advance this video was pure gold!
It's possible. Bad news is you need to set up each stock individually. There are a million and one prebuilt ma crossover strategies in the library. Choose one which includes an alert in the code and then set that alert up as an alarm for each market you want to trade.
Great video. Is there a way to script /know if current candle is higher on current close vs highest in Premarket same as if lower ?? Can u create A filter for this ??
I mainly trade crypto so it's open 247. I would hazard a guess that you need to get premarket data from somewhere and the use the time function to put in the market trading hours or something like that. I vaguely remember an update recently from the pinescript Devs about a specific function to give true or false if it's in trading hours so might be worth googling that. But generally I don't use it so can't help, sorry.
You can set a slippage amount when defining the strategy. Is that kind of what you are looking for or could you make it work? More info here: www.tradingcode.net/tradingview/strategy-slippage-setting/
Can I depend on using pine script indicators or strategies from authors that is deemed it open source or not from tradingview such that if I trade real money with that it simply won't disappear one day; if not then how can I personallize the open source without trading view? Your thoughts please.
Cross over is pretty straight forward if ta.ma(30,close) > ta.ma(200,close) Martingale might be a bit more difficult and not sure I understand it well enough to have any conviction.
Hi James, excellent video. I have one question? In wich way can I connect my Pinescript strategy to FTX exchange? I want to do like an automatically trading trough the strategy. But I can't find a tutorial, I can't connect the strategy to the exchange, thank you
Pinescript isn't great for execution. I would recommend using a separate script which interacts with the FTX API to collect data and manage orders/positions
@@JamesBachini , wow, I was ready to pay $$ for your info! Please tell us how your trading is going. With BTC and ETH at all time highs now, you should be rich!
Hey James, thank you for the great videos u provide. I have one question: I'm referencing the same type of candles (a shooting star candle) == x - I assign the last shooting star that appears on the chart to a variable (x) - Previous x candle is (x-1), I don't mean here X[1] but the previous shooting star. - The one before the previous is (x-2) and so on How can I find if X closed higher or lower than (X-1) and (x-2) Then another type of candles (hammers) is assigned to (Y); == Y - similarly there is (y-1) & (y-2); How can I check if x closed higher than (y) or lower than ( y-1) I would appreciate your help very much. thanks again!
Hi Mamu, could you store the values in an array and then check back? So if candle is a shooting star push close price to an array. www.tradingview.com/pine-script-docs/en/v4/essential/Arrays.html
Wait for a breakout 😉 When the market is ranging mean reversion strategies tend to work better than trend following. Usually volatility and trading volumes are lower too which makes it more difficult than upOnly market mode.
"" Add to Chart operation failed, reason: Script could not be translated from: null "" I wrote the code at the bottom of the trading view script api I entered what is the cause of the error?
Hard to say without seeing the code. Perhaps try copying and pasting from the blog post or editing an indicator from the tradingview libraries to get started and familiar with it.
Awesome and clean explanation. Quick question, what code should i use to exit when a condition that involve last 7 candles stops being true? Thanks in advance and keep up the good content :)
Sorry it's not something I can do. I'd be careful about paying anyone to code you entry signals. Entries are overrated, risk management is more important to long term success.
@@JamesBachini actually I just wanna learn how to set an entry after my inside bar, and the next candle buys at the open price. I want it to buy when the price breaks above the inside bar previous candle
Hi James, Do you know what technology stack is used behind tradingview. I mean to say when we can see price is updating real time without any ajax call. I would like to know what is used behind it.
Thanks James. Is it possible to create alerts when condition is fulfilled regardless of ticker name? for example: I want to receive an alert for any symbol that it MA7 crosses up its MA20 (1 day interval).
Would you still recommend manually testing strategies so it's more true to life like you can with Forex Tester for example, or is it okay to do automate the backtesting like this and then trade live markets?
I'm not familiar with Forex tester but setting up a demo account and trading on that to start with until the thesis has some unbiased data is probably a good idea
I think FTX uses Tradingview as standard, Binance it's optional via a tab above the chart, I believe their in-house charts are the default option. For developing with pinescript I'd recommend using the main Tradingview site as it has a built in editor etc. You don't need a subscription to use it.
@@JamesBachini Yes, they both use traidingview but I don't see where I can add the code to create an indicator... That part of the interface isn't present. I'll have to take a closer look.
Hey James, Thanks for the video tutorial. I am looking for functionality like below- User mouse over any candle and a new label will display over it showing the difference between open and close price. It can be already completed candles or running candle.
I've not seen code to do onhover before. That doesn't mean it's not possible just that I've never seen it. Start with Google or if you've seen another inidcator using it check the code. The labels themselves are quite straightforward to do what you want. Something like this. label.set_text(close - open) I'm just not sure if it's possible to get them to display only on candle mouse over.
@@JamesBachini thanks for the reply.. I think there must be something in pine script that will allow us to do that because when we mouse over any candle the at top you can see open, close, high, low values. Not sure if such kinda functionality also available in pine.. But I guess there should be..
@@RajeshB65 you've probably hit the nail on the head there. There's quite a lot that should be in pinescript but isn't. It's a compromise between having a powerful scripting language and keeping as simple as possible. I saw they added tooltips recently but I don't think that can be used on candles. Might be worth putting in a feature request if you can't find a way to do it. One way you could potentially do something similar is to just output the current candle to a label. Another way would be to plot a chart of the open - close price difference. So you'd have another line over the top which would show values. Not ideal but maybe a viable workaround doing something like this.
Great video! Very helpful and appreciate all the work you put into this. What server do you recommend to run on? When converting pine script to JavaScript is it difficult to replicate?
I use cloud server instances like AWS hosted as close to the exchange as possible. It depends on the amount of logic in the strategy and the exchange API integration. The entry exit signals tend to be only a small part of a system trading bot and a lot of the work goes into risk management and analytics as well.
@@JamesBachini makes sense! I work with python but also I’m interested in getting into Java script. Do you find Java script easier to translate from pine script?
@@JoelNove no python would be a better choice if you are already familiar with it. There're a lot of data science and ml applications built for python too so it's ideal for crunching exchange data. You should find python sdks for the exchange APIs or if not it's easy enough to work with a http agent and rest API.
@@JamesBachini Thanks for your help 2 months ago. I’ve came a long way with improving my python algo skills, back testing and putting bot on AWS. My question is I found AWS t2.micro that I’m using is REALLY slow. I’m thinking about upgrading to t2.medium. Do you recommend something larger? Thanks!
As an experienced python programmer, this format and pace was just right for me. Many Thanks.
I am not from a coding background(wanna be), but the way you explained everything is really good. Thanks.
Hey Viny, if you're still interested in Pinescript, I wanted to let you know about a software I've created that automates the backtesting of strategies in thousands of different scenarios. Once you input your strategy into the software, it tests it on dozens of different assets and timeframes to see where it performs best. So, with just one command, you can backtest your strategy not only on one pair or commodity, but on dozens of them, including stocks, cryptocurrencies, and more.
But the best part is that the software can also change the variables in your script. For example, it can find the perfect value for your stop loss and take profit in different scenarios or try dozens of different values for moving averages, MACD, RSI, ATR, Bollinger Bands, or any indicator you're using.
The results are incredible because with just one command, you get thousands of different combinations for your strategy without having to do anything. And it's 100% safe that you'll find a setting that performs better than the one you were using by default. Why? Because every strategy can be fine-tuned by trying better values for the indicators, or because it's a strategy that doesn't work well on the asset you're using but performs great on another one, or it performs better on a different timeframe than the one you usually use.
I'm also subscribed to TradingView's Premium plan, which allows me to backtest with all the data available on the platform, going back 50 years for daily candles and 22 years for 30-minute candles.
If you want to check it out, I invite you to visit my Fiverr page. As I found you, I'll give you the first round for free, where I'll provide you with the results of your strategy in 100 different scenarios, and you'll immediately see how powerful it is. I always deliver a file with the raw data table and an Excel file with graphs and filters to quickly find the most performing strategies among the thousands tested.
You can find me on Fiverr by searching for "I will automate thousands of backtests." If you see more than one person, look for the one with the username "codingtrading." Feel free to message me there, even just to give me your thoughts, as I'm new to the platform. Thanks a lot!
I just discovered your video, and it was very easy to understand. It was well-organized and clearly explained. I'm new to Pine scripting. so I'm saving this to my playlist. Thanks!
Excellent crash course, answered pretty much all the questions I had from other Pine Script videos. Thanks for the detailed info.
Thank you
@@JamesBachini hi James, excellent video!! I m looking for someone who developes some strategies in trading view.
Do you work for clients?
@@aldolabuonora I don't sorry. Might find someone upwork or freelancer if you search for pinescript. Alternatively there's a big public library you can use to search for a similarish strategy and try and contact the author who will understand it.
Excellent is the best word for this... now I learned pine script in about ten minutes....great job! Very interesting the last minutes how to create a javascript file for advanced doing...I ll read all on your site!
mad respect for you james, this is the best, right to the point pinescript tutorial i need!
Amazing! Thank you so much for the video. An extremely underrated channel in my opinion
This is the first time I give a like, subscribe and leave a comment in a video, but this kind of information certainly deserves it. Truly amazing content!!! Thank you and keep up with the good work!
Hey man, if you're still interested in Pinescript, I wanted to let you know about a software I've created that automates the backtesting of strategies in thousands of different scenarios. Once you input your strategy into the software, it tests it on dozens of different assets and timeframes to see where it performs best. So, with just one command, you can backtest your strategy not only on one pair or commodity, but on dozens of them, including stocks, cryptocurrencies, and more.
But the best part is that the software can also change the variables in your script. For example, it can find the perfect value for your stop loss and take profit in different scenarios or try dozens of different values for moving averages, MACD, RSI, ATR, Bollinger Bands, or any indicator you're using.
The results are incredible because with just one command, you get thousands of different combinations for your strategy without having to do anything. And it's 100% safe that you'll find a setting that performs better than the one you were using by default. Why? Because every strategy can be fine-tuned by trying better values for the indicators, or because it's a strategy that doesn't work well on the asset you're using but performs great on another one, or it performs better on a different timeframe than the one you usually use.
I'm also subscribed to TradingView's Premium plan, which allows me to backtest with all the data available on the platform, going back 50 years for daily candles and 22 years for 30-minute candles.
If you want to check it out, I invite you to visit my Fiverr page. As I found you, I'll give you the first round for free, where I'll provide you with the results of your strategy in 100 different scenarios, and you'll immediately see how powerful it is. I always deliver a file with the raw data table and an Excel file with graphs and filters to quickly find the most performing strategies among the thousands tested.
You can find me on Fiverr by searching for "I will automate thousands of backtests." If you see more than one person, look for the one with the username "codingtrading." Feel free to message me there, even just to give me your thoughts, as I'm new to the platform. Thanks a lot!
i cant believe you gave us a treasure..thank you so much
What a helpful video!
I was able to completely create my strategy with the help of your video.
Thanks from Korea.
Awesome, hope it's profitable for you 👍
Awesome video. The chop is the problem. How to recognize it programmatically and switch strategy or at least stop trading is the question. Thank you for sharing your knowledge. excited to check out your other videos.
Recognising what stage the market is in and adjusting focus on mean reversion strategies in choppy conditions and trend following strategies when there is momentum. Things like volatility indexes and distance from long term moving averages can help alongside market sentiment checks.
super genuine information in short time ! thankxx
Amazing explanation of pine scripting concept. Thanks a lot.
best pine script explanation
Thanks James, no doubt this channel will grow!!!
Subscribed. Liked.
And thank you!
First video I watched as a total beginner and it really gave the overview I was looking for exactly. Many thanks 🙏
Man you are A W E S O M E thank you so much for this
excellent and concise info. thank you
Good tutorial at the right pace and details!
Hey man, if you're interested in Pinescript, I wanted to let you know about a software I've created that automates the backtesting of strategies in thousands of different scenarios. Once you input your strategy into the software, it tests it on dozens of different assets and timeframes to see where it performs best. So, with just one command, you can backtest your strategy not only on one pair or commodity, but on dozens of them, including stocks, cryptocurrencies, and more.
But the best part is that the software can also change the variables in your script. For example, it can find the perfect value for your stop loss and take profit in different scenarios or try dozens of different values for moving averages, MACD, RSI, ATR, Bollinger Bands, or any indicator you're using.
The results are incredible because with just one command, you get thousands of different combinations for your strategy without having to do anything. And it's 100% safe that you'll find a setting that performs better than the one you were using by default. Why? Because every strategy can be fine-tuned by trying better values for the indicators, or because it's a strategy that doesn't work well on the asset you're using but performs great on another one, or it performs better on a different timeframe than the one you usually use.
I'm also subscribed to TradingView's Premium plan, which allows me to backtest with all the data available on the platform, going back 50 years for daily candles and 22 years for 30-minute candles.
If you want to check it out, I invite you to visit my Fiverr page. As I found you, I'll give you the first round for free, where I'll provide you with the results of your strategy in 100 different scenarios, and you'll immediately see how powerful it is. I always deliver a file with the raw data table and an Excel file with graphs and filters to quickly find the most performing strategies among the thousands tested.
You can find me on Fiverr by searching for "I will automate thousands of backtests." If you see more than one person, look for the one with the username "codingtrading." Feel free to message me there, even just to give me your thoughts, as I'm new to the platform. Thanks a lot!
Excellent. Thanks for the detailed info.
Thank you, James, appreciate the share and learnings.
Keep it up, really good the way you explain.
This really helped reduce the learning curve
Hi James, I like this video, keep doing your great job
Hi James, thank you for the awesome content you put together. much respect for the way you presented and how all the concept you delivering come together at the end. Screen visual was not so good though, i hope you take it well for improvement. Overall, brilliant video. Thanks once again.
Brilliant video - thanks!
thank you the knowledge is very helpful for beginners like me
this is a good and simple explanation
super helpful video! thank you so much!
Nice video. 5:12 I suggest to re-edit this part to take out FTX
Good point, if only it was possible to edit UA-cam vids)
I like this tutorial , great job
Great video! Thanks James.
Your videos really are very helpful - thank you! :)
Chat GPT does pinescript real well. Was looking at using capitalize AI strategys
Hell yeah dude I just made one
They keep giving me errors.
this has been very helpful, only thing I gotta say is maybe turn the white balance down cause it looks like you have a tanning and albino filter on at the same time
Lol thanks ☺️
Thank you for the great video. However, I faced an issue at the beginning as I got an error "line 5: Could not find function or function reference 'study'."
Try upgrading the code to v5
www.tradingview.com/pine-script-docs/en/v5/migration_guides/To_Pine_version_5.html
Great intro. Thanks so much. I have experience with javascript , java , C , VB -What language do yo recommend I learn to code a forex bot connected to Pepperstone for example ?
I'm not familiar with Pepperstone but check the API and see what wrappers they have. Probably NodeJS using JavaScript would be a good choice as a simple scripting language. That's what I use so probably have a bias here.
If you are doing very low time frame quant stuff where speed is essential then there might be some benefit to using C.
Only other factor would be if you are looking at doing a lot of machine learning work in which python is normally the weapon of choice.
Probably overcomplicating a simple question. My general recommendation would be JavaScript using NodeJS. Can run it locally to start with and then migrate to a server or microservice for production.
@@JamesBachini Thankyou. That's very helpful.
thanks for sharing valuable information. I need to develop pine script for session volume profile strategy, can you please guide me. Thanks.
Start with the docs you can pull volume data and then start to work with it to develop your strategy
It's very nice content , well explain
WOW and thank you!!!
Thank you!
Hi, pls advise how to write "forecast" pine on tradingview. Thanks
Hey James, where do you run your nodes? On your pc 7/24 or any cloud server to advice?
I generally start with them running locally because I'm breaking/tweaking things constantly and then once they are fairly stable I'll migrate them to a secure environment.
Do you help to create one single indicator combination of 6 indicators
Great video! Could you please make an updated video for version 5?
Yes will do 👍
Hi could you please create a video about hicknachi strategy code, need high time frame with green to red and red to green based long and short
Perfect Thanks !!
James, great video! Direct to the point, swift and not boring and useful!
If we are to build our own server for live algo trading using python, which framework would you use? Backtrader, VectorQT...etc? (I am just a beginning willing to spend much time to learn. Just want to find the right direction to invest my learning hours)
If I was doing it I would just connect directly to the exchange api using rest or websockets. Each exchange is different but in crypto markets you can get data and post trades quite easily.
@@JamesBachini (williams Fractals) tredingview indicator's convert the signals of this pinscript into a script that gives signals one minute in advance
Great video bro.
Ωplus1
④⑧⓪④④7①⓪03
Here, for more info hit channel in w@sp
Nice video
thank you for your effort, I have a question, How Can we convert mt4 or mt5 indicators or templates to Tradingview?? How we use them in tradingview??
I don't know of any automated way. Probably need to recode them
@@JamesBachini thank you for answer sir
nice work!
nice..how i can try to use this strat..thanks
Hey, good evening! I am from another country, very poor! I found it very exciting to watch this video and everything else! I couldn't understand 100%, and I would like to know if it's possible to get this script somehow?
Link to code in the description
Have you been able to add sound alerts (beep) to your crossover points? Thank you
I haven't tried, but sounds like a fun script. I have notifications setup to the mobile app and that works well.
Hi James, many thanks for the lesson. One question can I using pine script monitor several symbols? Let's say I am looking 50 different assets: is there a way in pine script to get a alert for when any of those 50 papers cross a moving average for example... again many thanks
No the alerts are a bit intentionally awkward in my opinion. You would need to set one up every 3 months for each asset. I think there is a limit on the number of alerts you can have too based on your fee tier. I guess it's done this way to protect system resources but it makes it awkward to build out a custom screener/alert system like what you are after.
I'd suggest if you want to do it get the data from somewhere else like Tiingo and set up a custom script with alerts on something like Twilio.
I want to check if 3,4,5 candles closed within the body of previous candle(this candle is slightly bigger than other candles)
How do I program it to sell after it made for example, 100 cents? My entry is after the moving average crosses over another MA.
Store the entry price in a variable and then check on each candle if price > entry +100
@@JamesBachini Thanks.
@@Berghiker here's some code that shows how to do stop losses and take profits. You can use this as a base and adjust it to whatever you need.
Awesome.
Can you create ICT unicorn model strategy pine script
How do I change the stopLoss from percent to cents or ticks?
Set a variable for your entry and the check if the current price is $0.0x away from your entry
thanks for the tutorial. I'm new to this, and pasted your code into my Pine Editor, but when I tap 'Strategy Tester' I get a Caution message "This Strategy did not generate any orders throughout the testing range". I've checked every line but not sure why its not working for me. Would appreciate any tips on this :)
Could you try it on a different market or timeframe?
Thanks a lot!!
i have created an indicator and turned it to strategy but when i load it to strategy tester it does not take any trades. i dont know how to proceed
If you've tried it against multiple markets and timeframes I expect it's something to do with the condition where it opens the trade. Hard to advise more but you could probably put it into chatGPT and ask why isn't this taking any trades
what is best time frame to you this code on?? Do you have any public that u can use on US stock market?? thanks great video
It really depends on the situation and volatility of the traded asset. In theory it will work with stocks but you may want to fit the moving average to the data and backtest each stock individually.
Excellent vid, thx
Hi my name is Jeffrey
Please I would like to know how to setup TLM trading view strategies
Can't see the code in phone screen it's too tiny. Please zoom on the code.
Thank you.
I was thinking of writing my own advisor in MT5. It looks like TV might be a better and more modern solution.
I think it's fine for visualising data but mt5 or just a script might be better for actually executing the trades
thanks for the video James, I'm new to this and want to modify an existing indicator on Tradingview but not quite sure how to do it. Specifically, I want to use the existing Stochastic Momentum Index to get the same alerts on crossings of SMI & SMI-based EMA but add a condition to get those alerts only when crossing happens in the oversold or overbought region. Do you know how I can add this condition? Should the pine code be changed from indicator to study or strategy and rewritten or is there an easier way to modify it? thanks
You could maybe use something simple like RSI to check if it's overbought or oversold and add a condition for that when popping the alert? Combine it with something like this www.google.com/amp/s/zenandtheartoftrading.com/pinescript/generate-trading-signals-with-rsi/%3famp
@@JamesBachini thanks for the reply, I’ll check it out!
Great tutorial. How can we define the position size (cash) which is variable value for each order?
when i try this, it calculates different size:
strategy(title="xxx", overlay=true, initial_capital=1000, default_qty_type=strategy.cash, default_qty_value=1)
strategy.entry("Long", strategy.long, when=long_condition, qty=position_size)
the "position_size" is a float value which i calculated with risk management.
I think it's qty in the entry function
strategy.entry(id="foo", long=true, qty=50)
@@JamesBachini I got it. "calc_on_every_tick=false" makes the differance between my qty and realtime qty 😁. When it's true, the calcs are ok. Thanks for the reply
Hello! Great video. I was wondering if there is a way to combine EMAs with an indicator? Like the Ttm squeeze, RSI, or stochastic?
yeah it's quite simple to do you just use an if statement with multiple checks
if (ta.ema(source, length) and ta.rsi(source, length)) {
// do whatever here
}
Something like that I think from memory. Or you might need to do it like
FilterOK = false
Filter1 = close > open
Filter2 = rising(volume,1)
FilterOK := Filter1 and Filter2
@@JamesBachini ok thank you
Thanks 🙏
James is there anyway to set up an alert for all stocks that meet a specific crossover ? Example if apple 20 crosses the 100 ema then i would automatically get an alert. But i want if for all stocks this happen for not just one stock. Any idea? Thanks in advance this video was pure gold!
It's possible. Bad news is you need to set up each stock individually. There are a million and one prebuilt ma crossover strategies in the library. Choose one which includes an alert in the code and then set that alert up as an alarm for each market you want to trade.
How do you plot the number of the length of the candle(low to high) above the candle?
Great video.
Is there a way to script /know if current candle is higher on current close vs highest in Premarket same as if lower ?? Can u create
A filter for this ??
I mainly trade crypto so it's open 247. I would hazard a guess that you need to get premarket data from somewhere and the use the time function to put in the market trading hours or something like that. I vaguely remember an update recently from the pinescript Devs about a specific function to give true or false if it's in trading hours so might be worth googling that. But generally I don't use it so can't help, sorry.
Please make a video tell me how to create source "Previous Indicator's Data" for RSI similar as MT4
I don't think there's a way to do that sorry. You would probably need to combine the two indicators into a single script
hey nice video ! one question : how to add a price deviation for entry and exit - for more realistic simulation on TV.
Tahnk you :)
You can set a slippage amount when defining the strategy. Is that kind of what you are looking for or could you make it work?
More info here:
www.tradingcode.net/tradingview/strategy-slippage-setting/
Can I combine MACD and EMA together with MACD overlay false and EMA overlay true?
Sure, you can do conditional statements in piescript so something like
If this and this { enter long }
Can I depend on using pine script indicators or strategies from authors that is deemed it open source or not from tradingview such that if I trade real money with that it simply won't disappear one day; if not then how can I personallize the open source without trading view? Your thoughts please.
You shouldn't be using them for actual trading. Useful for visualising and developing strategies but not suitable for execution in my opinion
thank you
Kindly publish video on Moving average crossover with martingale position sizing.. thanks
Cross over is pretty straight forward
if ta.ma(30,close) > ta.ma(200,close)
Martingale might be a bit more difficult and not sure I understand it well enough to have any conviction.
Hi James, excellent video. I have one question? In wich way can I connect my Pinescript strategy to FTX exchange? I want to do like an automatically trading trough the strategy. But I can't find a tutorial, I can't connect the strategy to the exchange, thank you
Pinescript isn't great for execution. I would recommend using a separate script which interacts with the FTX API to collect data and manage orders/positions
Example code here
jamesbachini.com/order-execution-strategy/
@@JamesBachini
Did you get burned with FTX? I did :'(
@@samiab6077 yes I had some FTT on there :"(
I can't seem to get this right. Can it be done?
That awesome, I love this kind of video. Do you have any pine script tutorial more?
No that was the only one. I'll try and get some more recorded. Thank you
@@JamesBachini , wow, I was ready to pay $$ for your info! Please tell us how your trading is going. With BTC and ETH at all time highs now, you should be rich!
@@lasvegasbrad no complaints. Euphoric with markets at all time highs 👍
Hey James, thank you for the great videos u provide. I have one question: I'm referencing the same type of candles (a shooting star candle) == x
- I assign the last shooting star that appears on the chart to a variable (x)
- Previous x candle is (x-1), I don't mean here X[1] but the previous shooting star.
- The one before the previous is (x-2) and so on
How can I find if X closed higher or lower than (X-1) and (x-2)
Then another type of candles (hammers) is assigned to (Y); == Y
- similarly there is (y-1) & (y-2);
How can I check if x closed higher than (y) or lower than ( y-1)
I would appreciate your help very much. thanks again!
Hi Mamu, could you store the values in an array and then check back? So if candle is a shooting star push close price to an array.
www.tradingview.com/pine-script-docs/en/v4/essential/Arrays.html
Is there a way to have just the long position show and not the EMA?
On a mobile so can't see the code but perhaps try removing the plot commands for each moving average?
Hi James, how to remove the choppy signals, when the market is ranging? Thanks
Wait for a breakout 😉
When the market is ranging mean reversion strategies tend to work better than trend following. Usually volatility and trading volumes are lower too which makes it more difficult than upOnly market mode.
Sir, how do i want to change colour for my sell n but icon in the indicator? I meam how to change it in script?
Some info here on colours
www.tradingview.com/pine-script-docs/en/v4/essential/Colors.html
"" Add to Chart operation failed, reason: Script could not be translated from: null ""
I wrote the code at the bottom of the trading view script
api
I entered what is the cause of the error?
Hard to say without seeing the code. Perhaps try copying and pasting from the blog post or editing an indicator from the tradingview libraries to get started and familiar with it.
I want to code dominant candle breakout into pinescript indicator but I am unable to do so.
Awesome and clean explanation.
Quick question, what code should i use to exit when a condition that involve last 7 candles stops being true?
Thanks in advance and keep up the good content :)
Thank you!
You can use something like strategy.close(all); which will close any open trades
is it possible to get I private class only to talk about a type of entry strategy? How much would it be? Thanks
Sorry it's not something I can do. I'd be careful about paying anyone to code you entry signals. Entries are overrated, risk management is more important to long term success.
@@JamesBachini actually I just wanna learn how to set an entry after my inside bar, and the next candle buys at the open price. I want it to buy when the price breaks above the inside bar previous candle
@@boralabrodi3641 can you just set a variable on the previous candle and use that in a if statement for an entry signal?
Hi James,
Do you know what technology stack is used behind tradingview.
I mean to say when we can see price is updating real time without any ajax call.
I would like to know what is used behind it.
I assume web sockets but don't know for sure
Thanks James. Is it possible to create alerts when condition is fulfilled regardless of ticker name? for example: I want to receive an alert for any symbol that it MA7 crosses up its MA20 (1 day interval).
Only way I've seen to do it is to set one alarm per ticker
@@JamesBachini Thanks again James
Would you still recommend manually testing strategies so it's more true to life like you can with Forex Tester for example, or is it okay to do automate the backtesting like this and then trade live markets?
I'm not familiar with Forex tester but setting up a demo account and trading on that to start with until the thesis has some unbiased data is probably a good idea
@@JamesBachini Thank you 👍
Is this Pine Editor available in Binance or FTX? Or, is this reserved for Tradingview subscriptions only?
I think FTX uses Tradingview as standard, Binance it's optional via a tab above the chart, I believe their in-house charts are the default option. For developing with pinescript I'd recommend using the main Tradingview site as it has a built in editor etc. You don't need a subscription to use it.
@@JamesBachini Yes, they both use traidingview but I don't see where I can add the code to create an indicator... That part of the interface isn't present. I'll have to take a closer look.
@@scottdorrofield3789 I think you can add custom indicators but probably can't edit the pinescript in an embedded chart.
Hello James, great content. Do you offer coding services? I would like to test out a strategy but dont know how to develop it
Sure can you send me the details of what you want to do
jamesbachini.com/blockchain-developer-consultant/
Hey James,
Thanks for the video tutorial.
I am looking for functionality like below-
User mouse over any candle and a new label will display over it showing the difference between open and close price.
It can be already completed candles or running candle.
I've not seen code to do onhover before. That doesn't mean it's not possible just that I've never seen it. Start with Google or if you've seen another inidcator using it check the code.
The labels themselves are quite straightforward to do what you want. Something like this.
label.set_text(close - open)
I'm just not sure if it's possible to get them to display only on candle mouse over.
@@JamesBachini thanks for the reply..
I think there must be something in pine script that will allow us to do that because when we mouse over any candle the at top you can see open, close, high, low values.
Not sure if such kinda functionality also available in pine..
But I guess there should be..
@@RajeshB65 you've probably hit the nail on the head there. There's quite a lot that should be in pinescript but isn't. It's a compromise between having a powerful scripting language and keeping as simple as possible. I saw they added tooltips recently but I don't think that can be used on candles. Might be worth putting in a feature request if you can't find a way to do it.
One way you could potentially do something similar is to just output the current candle to a label. Another way would be to plot a chart of the open - close price difference. So you'd have another line over the top which would show values. Not ideal but maybe a viable workaround doing something like this.
@@JamesBachini yeah!
I am successfully able to do that..
Great video! Very helpful and appreciate all the work you put into this.
What server do you recommend to run on? When converting pine script to JavaScript is it difficult to replicate?
I use cloud server instances like AWS hosted as close to the exchange as possible.
It depends on the amount of logic in the strategy and the exchange API integration. The entry exit signals tend to be only a small part of a system trading bot and a lot of the work goes into risk management and analytics as well.
@@JamesBachini makes sense! I work with python but also I’m interested in getting into Java script. Do you find Java script easier to translate from pine script?
@@JoelNove no python would be a better choice if you are already familiar with it. There're a lot of data science and ml applications built for python too so it's ideal for crunching exchange data. You should find python sdks for the exchange APIs or if not it's easy enough to work with a http agent and rest API.
@@JamesBachini Thank you!
@@JamesBachini Thanks for your help 2 months ago. I’ve came a long way with improving my python algo skills, back testing and putting bot on AWS. My question is I found AWS t2.micro that I’m using is REALLY slow. I’m thinking about upgrading to t2.medium. Do you recommend something larger? Thanks!