Simple Backtest with Tradingview/Pine script

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

КОМЕНТАРІ • 227

  • @luigibaldo103
    @luigibaldo103 4 роки тому +55

    A very informative video and with my 7 months experience of forex trading and one thing I can assure is having a mentor or a tutor constantly guiding and teaching you can go a long way in making you successful.

    • @alfiesimmons8586
      @alfiesimmons8586 4 роки тому +6

      Trading can really be frustrating without constant supervision especially if you are newbie.

    • @ralphpeterson6806
      @ralphpeterson6806 4 роки тому +5

      Constant research is also necessary if you want to be an independent trader.

    • @timothyklaw5277
      @timothyklaw5277 4 роки тому +4

      Luigi Baldo I am also inexperienced can you tutor me or who do you trade with?

    • @luigibaldo103
      @luigibaldo103 4 роки тому +13

      I trade with Con. Edwin Earl because I believe he has the best trading pattern, honestly I feel he is the finest out there. You can reach him at consultedwinearl@gmail com

    • @alexbercs1969
      @alexbercs1969 4 роки тому +5

      It is all about having an experienced person with all the qualities to instruct you.

  • @curiouskittycat5977
    @curiouskittycat5977 2 роки тому +4

    Much appreciated it! I love that you speak fast, write a simple logical script and show the process. Something that some other videos take an hour to do and I don't have patience for it. Thanks so much!

  • @inkandeve
    @inkandeve 5 років тому +21

    Dennis... THANK YOU. Great video. You covered major points, and fast! Much obliged.

  • @JesusAmaTeMenino
    @JesusAmaTeMenino 4 роки тому +15

    Finally a decent video on the topic. Great content dude!

  • @bigfranchise
    @bigfranchise 2 роки тому +6

    Great video! Thank you for keeping everything simple and concise!

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

    Thank you. I just started pine script today (but with a fair bit of previous programming experience). Your video was really clear and helpful!

  • @thewisegamer6034
    @thewisegamer6034 4 роки тому +6

    Dude, you are so clear and explain things like crystal water, been looking for this kind of tutorial for ages, I’m subbing 🙂

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

    Just came across your video today, great help to get started! Thanks for sharing!

  • @ownagejuice1394
    @ownagejuice1394 4 роки тому +13

    thanks for this. you showed us the general view of backtesting. it would be nice if you could also show us the "EFFECTIVITY of the STRATEGY" like focusing on the success and effectiveness - GAINS vs LOSS as this is the main reason why we're backtesting

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

    the way code was explained and fine tuned ,was easy to follow

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

    Great intro to backtesting in TradeView with PineScript Editor.. Very clear. Thank you.

  • @sophiej.4059
    @sophiej.4059 3 роки тому

    Thanks Dennis!! Awesome contents! I programmed my first pine script within an hour.

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

    Modern and relevant information, straight to the point, thank you very much Im so glad I found your video

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

      ok #notarobot

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

      @@BroScro thank you for your comment, indeed I am not a robot, I am a man

  • @israelpg77
    @israelpg77 4 роки тому +1

    Excellent video, thanks for sharing, it includes some of the main points I was looking for, all this sounds now less overwhelming.

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

    Wow the exact strategy I am looking into....what a find!

  • @daviddickinson5685
    @daviddickinson5685 7 місяців тому

    Very clear! Thanks for the introduction!!

  • @NØkturnaI
    @NØkturnaI 4 роки тому

    Finally i completed my indicator. Thank you so much! Subscribed.

  • @volodymyrtruba7016
    @volodymyrtruba7016 4 роки тому

    Best guide on pine scripts. Thanks

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

    Of course great video. I haven't seen many like this one. On the other hand. It adds to my feeling of an overwhelming amount of backtesting work. I would estimate at present I have 3 years of backtesting to do. This just adds even more work.

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

    This was incredibly helpful. I'm going back in to see what the 1000.0 Contracts in the settings #23 & 24 represent.

  • @jahskido06
    @jahskido06 4 роки тому +1

    Thanks! That was simple and easy to understand. Transforming your strategy in code requires more tinkering though.

  • @Durandune
    @Durandune 4 роки тому +1

    I enjoyed this video very much, I have been struggling to learn MT4/MQL4, so I decided to go with Pine/TradingView instead and great videos like this one are one of the reasons why! Plus I am also learning JS so Pine is very easy to pick up
    Thank You

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

    Concise and neat explanation. thanks for sharing

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

    This is an amazingly informative video, thanks so much!

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

    Excellently done.

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

    Great tutorial. Thank you so much for making this!

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

    This is awesome! Thank you for sharing your knowledge

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

    Very interesting, thanks for making this

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

    Hi! It shows error " could not find function or function reference 'sma'. I put ema, ma but it shows same error. Please help me.

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

    You have next level skills! Thanks so much for all the quality content! Maybe you or someone on here can point me in the right direction. Is there a way to split consecutive similar signals in order to alert them separately in Pine? My study script spits out 3 consecutive similar buy signals and I would like to add an alert separately to each to pyramid my orders via alert automation. So... in short I would like to buy bigger on each similar signal in a study script. Any help would be greatly appreciated.

  • @cbaxtermusic
    @cbaxtermusic 9 місяців тому

    this was amazing, thank you for this

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

    Hey Dennis, this tutorial is EXTREMELY helpful. Thank you.

    • @BhanuPratap-eq4qw
      @BhanuPratap-eq4qw 3 роки тому

      Did you used it, if yes can you give me code, bcz I have tried it's unable to compile the code so plz give me code if you have plz

  • @R33lyfast
    @R33lyfast 4 роки тому

    This is fantastic. Thanks, from 2020.

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

    great and simple video.. time to write some serious code

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

    Great video

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

    Quick and dirty, just like I needed it. Ta.

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

    good job mate!

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

    Very nice video sir., Sir How can we add RSI, MACD and SMA together . Look should be same as we add each one by one. But if I want all on one click what can we do..?

  • @wassollderscheiss33
    @wassollderscheiss33 4 роки тому +1

    It's a great totorial. I say that as a professional software developer. You should in fact consider going to udemy (if thats any profitable in general). The instructors there are quite good and you seem to be able to keep up.

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

    I keep gettig "no data" when i run the initial code and help ?

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

    Good one I was waiting to see if you noticed that the signal was not showing on the chart because you were on 2014 when the signal did not start until 2015. 😁👍

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

      Hey man, are you interested in automating your backtest in thousands of different settings without effort? I have developed a software and I'm giving away first trials for free.

  • @aaronhart8566
    @aaronhart8566 4 роки тому +13

    Here's the simple backtest.
    //@version=4
    strategy("Moving Average Crossover")
    ema20 = ema(close, 20)
    ema50 = ema(close, 50)
    long = ema20 > ema50
    short = ema20 < ema50
    strategy.entry("long", strategy.long, 1000.0, when=long)
    strategy.entry("short", strategy.short, 1000.0, when=short)

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

    Thank you very much! :)

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

    very well explained. thank u!

  • @jaco9286
    @jaco9286 4 роки тому

    Great video bro thanks so much.

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

    Great tutorial, thanks a lot.

  • @ghost4658
    @ghost4658 4 роки тому

    Thanks!, simple and direct 👍🏻

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

    Loved it!

  • @odia-sanatani
    @odia-sanatani 3 роки тому

    great content

  • @HardstyleTrancer
    @HardstyleTrancer 4 роки тому +1

    Hi, i would like to know how to do this transactions in real time with the paper account and viewing each one trade on the label of the paper trading? Do you know how to do this?
    Thank you

    • @SirGalahadXs
      @SirGalahadXs 4 роки тому

      Paper trading and strategy testing are 2 completely different functions.

  • @sakaragarwal6296
    @sakaragarwal6296 4 роки тому

    please create more strategy testing videos, and kindly advise from where I can learn pine script, Thanks !

  •  4 роки тому +1

    cant find a way to check if the price = last 2 days high/ low
    trying this:
    strategy("2 day high low", overlay = true, calc_on_every_tick=true)
    long = crossover(lowest(2))
    sell = crossover(highest(2))
    strategy.entry("Long", strategy.long, 35, when = long)
    strategy.close("Long", when = sell)

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

    Thanks much! I wanted to learn MA cross pine script and you certainly did that! Now I need to find out how to change the data periodicity from daily to weekly in pine script. Does anyone know how?

  • @cihanisler478
    @cihanisler478 8 місяців тому

    This is what i need

  • @swapnilpatil2445
    @swapnilpatil2445 4 роки тому +2

    Hello sir, will you please create a video which explains how to work with sessions(Intraday , Weekly or Monthly)
    Example-Suppose I have a pine script,but I want it to run only when "DAY SESSION STARTS" . How to code it with pine script?
    Thanks in advance👍

  • @tanmayrauth7367
    @tanmayrauth7367 4 роки тому +1

    Great Video!! Can you help me to understand how can we run a strategy over a list of stock?

  • @eddu4361
    @eddu4361 4 роки тому

    Super helpful! 🙏👊👊

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

    Great¡¡¡¡ very helpful

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

    Simple and amazing video.
    But how to code to close position at end of the day?

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

    Very helpful!

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

    Hi Dennis .. thanks a ton for this information. I have one question I have created my code and wants to show sell alert when candle closes below emi .. and buy alert when candle closes crossing ema line. Please please help

  • @vicvictor1695
    @vicvictor1695 4 роки тому

    Much obliged.

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

    Hey dennis, first of all.. Thanks for this great video ! I was wondering if this pine coding gives signal in realtime or just used for backtesting

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

    Thanks a lot!

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

    Hi, i try to make a crossing ema strattegy, but i want to buy and sell just exactlly when the crossing ema happen, not in the open or close of the candle. It is anny way to calculate at real time the value of each ema and place the order exactlly when the crossing ema happen? Also i want to make it possible to view it and prove it on simulated strategy. Please help me. Thanks.

  • @smallinvestor9896
    @smallinvestor9896 4 роки тому +1

    i want to do algo trading from the strategy which i build in trading view ........how should i do....

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

    Super good!! If you wanna combine like an EMA strategy and set a condition like if ema4 >= sma6 "and macd = green" or something?
    I found this but can't make it work: macd = macd(close, 12,26,5)
    where macd color = color.green. I have an EMA+SMA strategy and wanna include like if my MACD is in green (I added the last one to 5 instead of 9 for a bit faster). Want to make it work.

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

      This is my code so far, Daily chart:
      ema4 = ema(close, 4)
      sma6 = sma(close, 6)
      macd = macd(close, 12,26,5)
      long = ema4 > sma6 //here I want to add something like: when macd color = color.green
      or made a cross
      short = ema4 < sma6
      start = timestamp(2017,9,1,0,0)
      end = timestamp(2021,6,24,0,0)
      if time >= start and time

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

    Sir, I want to code for a candlestick color i.e. if candle's real body is less than 50% of entire range/body of candle then that candle's color should be blue
    Plz help me to do it.

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

    Broker: you wanna buy or sell ?
    Trading view code : yes

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

    the trades arnt showing cause you set the dates to 2015 to 2019 and you are zoomed into 2013..

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

    But SPX is only options. Mostly 0DTE expiry. Any idea on how to implement that?

  • @whimsythecrypto-hippy-wolf1900
    @whimsythecrypto-hippy-wolf1900 2 роки тому +1

    what versoin of pine editor are you using? ema is giving me an error. ta.ema instead?

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

      if you use version 5 it is ta.ema, in version 4 it is ema.

  • @LSC29Dec12
    @LSC29Dec12 5 місяців тому

    Hi Dennis. Thanks for this. I already have script written by a developer but I cannot work out how to use the script to backtest on BTC, ETH, SOL, BCH, BNB, etc. Please could you help?

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

    Can you suggest me how to backtest a single moving average accuracy on list of stocks in tradingview

  • @AhmedVlogs1
    @AhmedVlogs1 4 роки тому

    How do i calculate a particular candles high/low example 5th candle ? of a particular session

  • @siddharthg4623
    @siddharthg4623 4 роки тому

    thank you so much for the video

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

    Are you on the highest tier subscription of TV? Because me it only lets do like 4 monhts back.

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

    thnx bro. i want to learn pine script pls suggest any channel or videos. Thnx again

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

    hi, your work is smart. is it possible to copy and paste the script in here?

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

    Hey Dennis, won't this strategy open a trade every time one EMA is above the other, not only on the crossing? How can we make it only on the crossover? Thanks

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

    Hello I have no experience of coding in pine. I want to test a strategy where long condition is go long if the highest of the last three candles is crossed and go short if the lowest of the last three candle is crossed. Tine= 1 hourly chart

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

    written:
    Line 13 if time >= start and time

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

    What do you type or omit if you do not want to go short?

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

    Dennis Hi,
    Really great content and thanks for posting,
    I keep getting this error (Add to Chart operation failed, reason: Could not find function or function reference hma)
    I tried changing the reference to ema like yours but still get the error?
    I will take it up with tradingview but I thought I'd give it a shot in this forum.
    Any help would be so awesome and thanks!
    Paul

  • @TheGangsterRH
    @TheGangsterRH 4 роки тому

    Great!
    But was this video in a lower resolution than expected or is it just me?

  • @jonaslukasevicius9521
    @jonaslukasevicius9521 4 роки тому

    Should this work with basic free account? In mine it says to go on pro account when pressed add to chart

  • @dasundesilva5588
    @dasundesilva5588 4 роки тому

    why use closeshort for closing long position and vise versa?

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

    ¨Add to Chart operation failed, reason: Script could not be translated from: null¨
    i wrote the exact same code as you. But then pops up this Info, Error.

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

    hi, the last order was still open. how can we close all position at the last trade? thanks.

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

    Thanks chief

  • @leoosorio9988
    @leoosorio9988 4 роки тому

    Greetings brother, very grateful for sharing your knowledge with the rest of us ... I confess that I have only been getting to know pine, but I have stalled in one detail and it is frustrating me not being able to continue ... I need to do a kind of trigger ... imagine an indicator that reached a value x, and returned ... an rsi for example, reached level 70 and returned, but I am interested in maintaining that record, something like SignalSale = 1 if rsi exceeds level 70 and that when it falls below 70 the value of SignalSale remains = 1 ... I would greatly appreciate some guidance

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

      How is it going 1 year later? are you still into pine script and has it added value to your trading? i am a beginner and i have been learning for 1 week now

  • @구독자500명되면이같은
    @구독자500명되면이같은 4 роки тому

    Hello. When setting commission as percentage, does it charge commission when both entering and exiting trade, or entering only?

    • @pAulseperformance
      @pAulseperformance 4 роки тому

      It charges commission on trade entry and trade exit just like live trading

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

    It's a good feature but i somehow find this not well controlled, like you cannot backtest of the close condition happens at candle close or at the highest profit or exactly at a percentage profit

  • @COW879
    @COW879 4 роки тому +26

    Moo

  • @adebear69
    @adebear69 4 роки тому

    Hi mate thanks for the video, I followed your example to learn but I'm getting an error when I add to chart that states undeclared identifier longcondition and undeclared identifier shortcondtion not sure what i did wrong?

    • @adebear69
      @adebear69 4 роки тому

      It was spelling mistakes sorry, how would you use this as an indicator that is alterable?

  • @gacctom
    @gacctom 4 роки тому

    thank your sharing

  • @cjeremie
    @cjeremie 4 роки тому

    thankyou so much

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

    ❤️❤️

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

    Nice sir, but how to code base on % profit taking i mean, how to create strategy using 1 risk 2 reward and money management too

  • @AndryRazafindrazaka
    @AndryRazafindrazaka 4 роки тому

    Thank you Bro!