Pine Script Tutorial | Developing Real Trading Strategies On TradingView

Поділитися
Вставка
  • Опубліковано 27 лис 2024

КОМЕНТАРІ • 377

  • @EarlWallaceNYC
    @EarlWallaceNYC Рік тому +5

    As an experienced python programmer, this format and pace was just right for me. Many Thanks.

  • @vinybaba493
    @vinybaba493 Рік тому +7

    I am not from a coding background(wanna be), but the way you explained everything is really good. Thanks.

    • @kevin.licenji
      @kevin.licenji Рік тому

      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!

  • @DIYerGirl
    @DIYerGirl Рік тому +7

    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!

  • @AlvinEvangelista
    @AlvinEvangelista 3 роки тому +28

    Excellent crash course, answered pretty much all the questions I had from other Pine Script videos. Thanks for the detailed info.

    • @JamesBachini
      @JamesBachini  3 роки тому +1

      Thank you

    • @aldolabuonora
      @aldolabuonora 2 роки тому

      @@JamesBachini hi James, excellent video!! I m looking for someone who developes some strategies in trading view.
      Do you work for clients?

    • @JamesBachini
      @JamesBachini  2 роки тому +1

      @@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.

  • @bree3073
    @bree3073 3 роки тому +2

    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!

  • @hksoros
    @hksoros Рік тому +4

    mad respect for you james, this is the best, right to the point pinescript tutorial i need!

  • @rohitkashyapx
    @rohitkashyapx 3 роки тому +6

    Amazing! Thank you so much for the video. An extremely underrated channel in my opinion

  • @sebastianllosa12
    @sebastianllosa12 2 роки тому +5

    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!

    • @kevin.licenji
      @kevin.licenji Рік тому

      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!

  • @sundancer06
    @sundancer06 2 роки тому +2

    i cant believe you gave us a treasure..thank you so much

  • @hypercub3
    @hypercub3 2 роки тому +1

    What a helpful video!
    I was able to completely create my strategy with the help of your video.
    Thanks from Korea.

    • @JamesBachini
      @JamesBachini  2 роки тому +1

      Awesome, hope it's profitable for you 👍

  • @curiouskittycat5977
    @curiouskittycat5977 7 місяців тому +1

    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.

    • @JamesBachini
      @JamesBachini  7 місяців тому +1

      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.

  • @ibrahimcelebi1366
    @ibrahimcelebi1366 2 роки тому +2

    super genuine information in short time ! thankxx

  • @RaghavaIndra
    @RaghavaIndra Рік тому +2

    Amazing explanation of pine scripting concept. Thanks a lot.

  • @Fahad-jh1zw
    @Fahad-jh1zw 3 роки тому +1

    best pine script explanation

  • @mladenpavla
    @mladenpavla 3 роки тому +4

    Thanks James, no doubt this channel will grow!!!

  • @cmzshalom
    @cmzshalom 3 роки тому +3

    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 🙏

  • @matiaswoiciechowski9356
    @matiaswoiciechowski9356 2 роки тому +1

    Man you are A W E S O M E thank you so much for this

  • @mirrorcube3709
    @mirrorcube3709 3 роки тому +3

    excellent and concise info. thank you

  • @KamalSingh
    @KamalSingh 3 роки тому +7

    Good tutorial at the right pace and details!

    • @kevin.licenji
      @kevin.licenji Рік тому

      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!

  • @javidafkar
    @javidafkar 3 роки тому +2

    Excellent. Thanks for the detailed info.

  • @LightchaserG
    @LightchaserG 2 роки тому +2

    Thank you, James, appreciate the share and learnings.
    Keep it up, really good the way you explain.

  • @trader8880
    @trader8880 3 роки тому +1

    This really helped reduce the learning curve

  • @SeasonedDev
    @SeasonedDev 3 роки тому +5

    Hi James, I like this video, keep doing your great job

  • @khumofx1838
    @khumofx1838 2 роки тому +8

    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.

  • @marci1964
    @marci1964 2 роки тому +2

    Brilliant video - thanks!

  • @arcdisney
    @arcdisney 11 місяців тому +1

    thank you the knowledge is very helpful for beginners like me

  • @mataloha
    @mataloha Рік тому +1

    this is a good and simple explanation

  • @nws4714
    @nws4714 3 роки тому +2

    super helpful video! thank you so much!

  • @alexp7274
    @alexp7274 10 місяців тому +2

    Nice video. 5:12 I suggest to re-edit this part to take out FTX

    • @JamesBachini
      @JamesBachini  10 місяців тому

      Good point, if only it was possible to edit UA-cam vids)

  • @yoonesgholamy6417
    @yoonesgholamy6417 3 роки тому +1

    I like this tutorial , great job

  • @neilwu4781
    @neilwu4781 Рік тому

    Great video! Thanks James.

  • @GlynisDance
    @GlynisDance 2 роки тому +1

    Your videos really are very helpful - thank you! :)

  • @gillyOO7
    @gillyOO7 5 місяців тому +3

    Chat GPT does pinescript real well. Was looking at using capitalize AI strategys

  • @dabbopabblo
    @dabbopabblo 3 роки тому +1

    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

  • @hanialadmaai5596
    @hanialadmaai5596 2 роки тому +3

    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'."

    • @JamesBachini
      @JamesBachini  2 роки тому +2

      Try upgrading the code to v5
      www.tradingview.com/pine-script-docs/en/v5/migration_guides/To_Pine_version_5.html

  • @HereIsmarcus
    @HereIsmarcus 3 роки тому +1

    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 ?

    • @JamesBachini
      @JamesBachini  3 роки тому

      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.

    • @HereIsmarcus
      @HereIsmarcus 3 роки тому +1

      @@JamesBachini Thankyou. That's very helpful.

  • @arjundhaigude9579
    @arjundhaigude9579 10 місяців тому +1

    thanks for sharing valuable information. I need to develop pine script for session volume profile strategy, can you please guide me. Thanks.

    • @JamesBachini
      @JamesBachini  10 місяців тому

      Start with the docs you can pull volume data and then start to work with it to develop your strategy

  • @SAKOLPLY
    @SAKOLPLY 2 роки тому +1

    It's very nice content , well explain

  • @rbbtllc1146
    @rbbtllc1146 3 роки тому +2

    WOW and thank you!!!

  • @naqijamal9933
    @naqijamal9933 Рік тому +2

    Thank you!

  • @derrickchow4019
    @derrickchow4019 28 днів тому

    Hi, pls advise how to write "forecast" pine on tradingview. Thanks

  • @bayfundamental
    @bayfundamental 2 роки тому +2

    Hey James, where do you run your nodes? On your pc 7/24 or any cloud server to advice?

    • @JamesBachini
      @JamesBachini  2 роки тому +1

      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.

  • @adithya-elearning
    @adithya-elearning Місяць тому

    Do you help to create one single indicator combination of 6 indicators

  • @deejaydaiel9181
    @deejaydaiel9181 2 роки тому +1

    Great video! Could you please make an updated video for version 5?

  • @NK-lp2bj
    @NK-lp2bj Рік тому +1

    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

  • @jimkoblick1776
    @jimkoblick1776 3 роки тому +2

    Perfect Thanks !!

  • @stansuen8072
    @stansuen8072 2 роки тому +2

    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)

    • @JamesBachini
      @JamesBachini  2 роки тому +3

      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.

    • @shadabahamad1250
      @shadabahamad1250 Рік тому

      @@JamesBachini (williams Fractals) tredingview indicator's convert the signals of this pinscript into a script that gives signals one minute in advance

  • @qadir03232803023
    @qadir03232803023 3 роки тому +1

    Great video bro.

  • @ssjmnews9997
    @ssjmnews9997 2 роки тому +1

    Nice video

  • @dailyshorts8989
    @dailyshorts8989 2 роки тому

    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??

    • @JamesBachini
      @JamesBachini  2 роки тому +1

      I don't know of any automated way. Probably need to recode them

    • @dailyshorts8989
      @dailyshorts8989 2 роки тому +1

      @@JamesBachini thank you for answer sir

  • @caruntualexandru
    @caruntualexandru 3 роки тому +1

    nice work!

  • @gavirtualhustle6572
    @gavirtualhustle6572 Місяць тому

    nice..how i can try to use this strat..thanks

  • @heltontorrini33
    @heltontorrini33 2 місяці тому

    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?

    • @JamesBachini
      @JamesBachini  2 місяці тому

      Link to code in the description

  • @rbbtllc1146
    @rbbtllc1146 3 роки тому +1

    Have you been able to add sound alerts (beep) to your crossover points? Thank you

    • @JamesBachini
      @JamesBachini  3 роки тому +1

      I haven't tried, but sounds like a fun script. I have notifications setup to the mobile app and that works well.

  • @DG10-youtube-channel
    @DG10-youtube-channel 2 роки тому +1

    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

    • @JamesBachini
      @JamesBachini  2 роки тому +1

      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.

  • @aamersaeed1529
    @aamersaeed1529 2 роки тому

    I want to check if 3,4,5 candles closed within the body of previous candle(this candle is slightly bigger than other candles)

  • @Berghiker
    @Berghiker 2 роки тому +1

    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.

    • @JamesBachini
      @JamesBachini  2 роки тому +1

      Store the entry price in a variable and then check on each candle if price > entry +100

    • @Berghiker
      @Berghiker 2 роки тому

      @@JamesBachini Thanks.

    • @JamesBachini
      @JamesBachini  2 роки тому +1

      @@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.

  • @davidjulien236
    @davidjulien236 Рік тому +1

    Awesome.

  • @kingali0011
    @kingali0011 4 місяці тому +1

    Can you create ICT unicorn model strategy pine script

  • @Berghiker
    @Berghiker 2 роки тому +1

    How do I change the stopLoss from percent to cents or ticks?

    • @JamesBachini
      @JamesBachini  2 роки тому +1

      Set a variable for your entry and the check if the current price is $0.0x away from your entry

  • @zacmason
    @zacmason Місяць тому

    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 :)

    • @JamesBachini
      @JamesBachini  Місяць тому

      Could you try it on a different market or timeframe?

  • @ameneh212
    @ameneh212 Рік тому +1

    Thanks a lot!!

  • @facepalmjesus1608
    @facepalmjesus1608 Місяць тому +1

    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

    • @JamesBachini
      @JamesBachini  Місяць тому

      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

  • @jleoarsenault6107
    @jleoarsenault6107 3 роки тому

    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

    • @JamesBachini
      @JamesBachini  3 роки тому

      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.

  • @pilotpug
    @pilotpug Рік тому

    Excellent vid, thx

  • @mkjeffrey4355
    @mkjeffrey4355 5 місяців тому +1

    Hi my name is Jeffrey
    Please I would like to know how to setup TLM trading view strategies

  • @memarket1675
    @memarket1675 2 роки тому +1

    Can't see the code in phone screen it's too tiny. Please zoom on the code.

  • @joshuam2341
    @joshuam2341 3 роки тому +1

    Thank you.

  • @johndough8699
    @johndough8699 2 роки тому

    I was thinking of writing my own advisor in MT5. It looks like TV might be a better and more modern solution.

    • @JamesBachini
      @JamesBachini  2 роки тому

      I think it's fine for visualising data but mt5 or just a script might be better for actually executing the trades

  • @sorooshd7895
    @sorooshd7895 4 місяці тому

    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

    • @JamesBachini
      @JamesBachini  4 місяці тому +1

      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

    • @sorooshd7895
      @sorooshd7895 4 місяці тому +1

      @@JamesBachini thanks for the reply, I’ll check it out!

  • @deniz9974
    @deniz9974 2 роки тому

    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
      @JamesBachini  2 роки тому +1

      I think it's qty in the entry function
      strategy.entry(id="foo", long=true, qty=50)

    • @deniz9974
      @deniz9974 2 роки тому

      @@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

  • @kltaito
    @kltaito 2 роки тому

    Hello! Great video. I was wondering if there is a way to combine EMAs with an indicator? Like the Ttm squeeze, RSI, or stochastic?

    • @JamesBachini
      @JamesBachini  2 роки тому +1

      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

    • @kltaito
      @kltaito 2 роки тому

      @@JamesBachini ok thank you

  • @lalitlkv07
    @lalitlkv07 Рік тому +1

    Thanks 🙏

  • @chrisjones4512
    @chrisjones4512 2 роки тому

    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!

    • @JamesBachini
      @JamesBachini  2 роки тому

      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.

  • @Berghiker
    @Berghiker Рік тому

    How do you plot the number of the length of the candle(low to high) above the candle?

  • @amywachsmuth4293
    @amywachsmuth4293 3 роки тому

    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 ??

    • @JamesBachini
      @JamesBachini  3 роки тому

      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.

  • @nguyenanhvu7345
    @nguyenanhvu7345 2 роки тому

    Please make a video tell me how to create source "Previous Indicator's Data" for RSI similar as MT4

    • @JamesBachini
      @JamesBachini  2 роки тому

      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

  • @jb9282
    @jb9282 3 роки тому

    hey nice video ! one question : how to add a price deviation for entry and exit - for more realistic simulation on TV.
    Tahnk you :)

    • @JamesBachini
      @JamesBachini  3 роки тому

      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/

  • @steveni4455
    @steveni4455 2 місяці тому

    Can I combine MACD and EMA together with MACD overlay false and EMA overlay true?

    • @JamesBachini
      @JamesBachini  2 місяці тому

      Sure, you can do conditional statements in piescript so something like
      If this and this { enter long }

  • @terranceroybal3222
    @terranceroybal3222 24 дні тому

    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.

    • @JamesBachini
      @JamesBachini  24 дні тому

      You shouldn't be using them for actual trading. Useful for visualising and developing strategies but not suitable for execution in my opinion

  • @thangbach6705
    @thangbach6705 3 роки тому +1

    thank you

  • @RahulSahu-ob8iv
    @RahulSahu-ob8iv 2 роки тому

    Kindly publish video on Moving average crossover with martingale position sizing.. thanks

    • @JamesBachini
      @JamesBachini  2 роки тому

      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.

  • @fabriziomeli2161
    @fabriziomeli2161 2 роки тому

    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

    • @JamesBachini
      @JamesBachini  2 роки тому

      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
      @JamesBachini  2 роки тому

      Example code here
      jamesbachini.com/order-execution-strategy/

    • @samiab6077
      @samiab6077 2 роки тому

      @@JamesBachini
      Did you get burned with FTX? I did :'(

    • @JamesBachini
      @JamesBachini  2 роки тому

      @@samiab6077 yes I had some FTT on there :"(

  • @Berghiker
    @Berghiker Рік тому

    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?

    • @JamesBachini
      @JamesBachini  3 роки тому

      No that was the only one. I'll try and get some more recorded. Thank you

    • @lasvegasbrad
      @lasvegasbrad 3 роки тому

      @@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!

    • @JamesBachini
      @JamesBachini  3 роки тому

      @@lasvegasbrad no complaints. Euphoric with markets at all time highs 👍

  • @silencecaptive
    @silencecaptive 3 роки тому +2

    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!

    • @JamesBachini
      @JamesBachini  3 роки тому +1

      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

  • @Traqy
    @Traqy 3 роки тому

    Is there a way to have just the long position show and not the EMA?

    • @JamesBachini
      @JamesBachini  3 роки тому

      On a mobile so can't see the code but perhaps try removing the plot commands for each moving average?

  • @batz9672
    @batz9672 2 роки тому

    Hi James, how to remove the choppy signals, when the market is ranging? Thanks

    • @JamesBachini
      @JamesBachini  2 роки тому

      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.

  • @HambaAllah-xx7ir
    @HambaAllah-xx7ir 2 роки тому

    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?

    • @JamesBachini
      @JamesBachini  2 роки тому

      Some info here on colours
      www.tradingview.com/pine-script-docs/en/v4/essential/Colors.html

  • @kaboliali1171
    @kaboliali1171 2 роки тому +1

    "" 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?

    • @JamesBachini
      @JamesBachini  2 роки тому

      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.

  • @aamersaeed1529
    @aamersaeed1529 2 роки тому

    I want to code dominant candle breakout into pinescript indicator but I am unable to do so.

  • @ICARTEN
    @ICARTEN 3 роки тому

    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 :)

    • @JamesBachini
      @JamesBachini  3 роки тому +1

      Thank you!
      You can use something like strategy.close(all); which will close any open trades

  • @boralabrodi3641
    @boralabrodi3641 2 роки тому

    is it possible to get I private class only to talk about a type of entry strategy? How much would it be? Thanks

    • @JamesBachini
      @JamesBachini  2 роки тому

      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.

    • @boralabrodi3641
      @boralabrodi3641 2 роки тому

      @@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

    • @JamesBachini
      @JamesBachini  2 роки тому

      @@boralabrodi3641 can you just set a variable on the previous candle and use that in a if statement for an entry signal?

  • @RajeshB65
    @RajeshB65 3 роки тому

    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.

    • @JamesBachini
      @JamesBachini  3 роки тому

      I assume web sockets but don't know for sure

  • @iMajedaldhafer
    @iMajedaldhafer 2 роки тому

    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).

    • @JamesBachini
      @JamesBachini  2 роки тому +1

      Only way I've seen to do it is to set one alarm per ticker

    • @iMajedaldhafer
      @iMajedaldhafer 2 роки тому

      @@JamesBachini Thanks again James

  • @baz914
    @baz914 Рік тому

    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?

    • @JamesBachini
      @JamesBachini  Рік тому +1

      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

    • @baz914
      @baz914 Рік тому

      @@JamesBachini Thank you 👍

  • @scottdorrofield3789
    @scottdorrofield3789 3 роки тому

    Is this Pine Editor available in Binance or FTX? Or, is this reserved for Tradingview subscriptions only?

    • @JamesBachini
      @JamesBachini  3 роки тому +1

      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.

    • @scottdorrofield3789
      @scottdorrofield3789 3 роки тому

      @@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.

    • @JamesBachini
      @JamesBachini  3 роки тому +1

      @@scottdorrofield3789 I think you can add custom indicators but probably can't edit the pinescript in an embedded chart.

  • @jspagnuolo
    @jspagnuolo Рік тому

    Hello James, great content. Do you offer coding services? I would like to test out a strategy but dont know how to develop it

    • @JamesBachini
      @JamesBachini  Рік тому

      Sure can you send me the details of what you want to do
      jamesbachini.com/blockchain-developer-consultant/

  • @RajeshB65
    @RajeshB65 3 роки тому

    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.

    • @JamesBachini
      @JamesBachini  3 роки тому +1

      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.

    • @RajeshB65
      @RajeshB65 3 роки тому

      @@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..

    • @JamesBachini
      @JamesBachini  3 роки тому +1

      @@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.

    • @RajeshB65
      @RajeshB65 3 роки тому +1

      @@JamesBachini yeah!
      I am successfully able to do that..

  • @JoelNove
    @JoelNove 2 роки тому

    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?

    • @JamesBachini
      @JamesBachini  2 роки тому +1

      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.

    • @JoelNove
      @JoelNove 2 роки тому

      @@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?

    • @JamesBachini
      @JamesBachini  2 роки тому +1

      @@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.

    • @JoelNove
      @JoelNove 2 роки тому +1

      @@JamesBachini Thank you!

    • @JoelNove
      @JoelNove Рік тому +1

      @@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!