How to DEBUG Pine Script Code

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

КОМЕНТАРІ • 46

  • @TheArtOfTrading
    @TheArtOfTrading  Рік тому +3

    🚩 My Socials & Free Email Newsletter: theartoftrading.com
    🚩 FREE Pine Script Basics Course: courses.theartoftrading.com/courses/pine-script-basics-course
    🚩 Pine Script Mastery Course: courses.theartoftrading.com/courses/pine-script-mastery
    🚩 My Indicators & Strategies Course (Steal My Code!): courses.theartoftrading.com/courses/my-indicators

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

      hi thanks for video you doing amazing. there is a simple but tricky situation that i'm confused about it : "how to write a statement that returns true only if the NEXT CANDLE is engulfing" ?

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

      @@mohammadrezaarefasl4975 i believe tradingview doesn’t allow you to check for future candle sticks. you could always compare the current candle to the one before it though

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

      Can you share how to deug a buy/sell strategy , ur this video is quiet useful but it only shows hw to debug indicators

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

    This really is THE example of how a coding channel must be. You explain every aspect really well and even a quite beginner like me can follow along nicely. Great job!

  • @curtisjackson3377
    @curtisjackson3377 Рік тому +3

    Great video. Thanks for another wonderful and crisp PSM tutorial.
    For getting rid of the multiple values of plot variables, I make use of "display = display.price_scale / pane " argument of plot function.

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

    Thanks a lot for this video because sometimes for debugging my scripts i was facing lot of problems to see the output quickly. Now i can see everything thanks a lot.

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

    Great video. I almost skipped this thinking I knew how to debug from some of your other course material but really glad I didn't as you showed me several new ways. Thanks -ds-

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

    Thank you! If I ever manage to really make it by automating my strategies I will reserve for you a percentage.

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

    A thorough tutorial always! Thank you for posting

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

    Hello sir i want to automate my trading view strategy for XAUUSD so that it will automatically take trades when i turnoff my pc how can i do that can you make a new video on that

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

    Great vid man thanks for the info 🙌❤️

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

    Big shoutout to you and your channel man. I recently was able to automate my Trading Strategy using your PineScript guide. Funny enough the algorithm I made gave me better results than when I manually traded. (Bots don't have emotions.) Ai the wave🔥😤

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

    Thanks i learned a lot !! I like how you explain the details!!!👍❤️

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

    4 spaces [tab] is reserved for compiler syntax so you don't have to use curly brackets (like in C) or End If, or Next I type statements (like in Basic). Therefore anything other than 4 spaces will work for a line continuation . This is an idea borrowed from Python.

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

    thanks man! But how about adding a freaking console.log equivalent command in pine script? It makes no sense one cannot debug easily and not bebug strings :/

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

    You helped me with that tab then a single space comment. That had me baffled. You can add display = display.none or whatever you prefer to plots for additional flexibility.

  • @J-D248
    @J-D248 7 місяців тому

    Perfect! Exactly what I am looking for :) thank you!😊

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

    I really appreciate your work and, notably, the fact that you share your code. It's a great source of information for me as I am learning Pine Script, as a hobby.
    I am currently trying to debug some code and want to see values of variables that are in local scope, as you refer to in this video. Do you know how this might be possible to do, please, even if it is to see the values in the output data window, if these cannot be shown in the chart window?
    For example, in your example in the video here, at around 10min in, you would like to see the value of "i" as it iterates through your "for i = 1 to 10" loop. Is there any way this is possible, please?

  • @KS-in3mg
    @KS-in3mg 11 місяців тому

    Great vid! Luv the pace, kept me engaged

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

    If I want to buy @ 9.15 am @open price and close @ 3 pm. How should I write code for this? pls suggest

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

    this is great man ,, thank you a lot ,, you opened my eyes on so much stuff that were holding me back ,, much appreciated .. keep the good work

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

    Dear sir create super trend with rsi to give more probability trade best settings to do algo trading

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

    great video, you saved my tons of time!

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

    bro i just paid masterycourse 97$ , will the videos be avaible one month only?? and then i wouldn t be able to see them?

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

    plot(close, display = display.data_window)

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

      Using the display flags should be the proposed way to debug values that are not inside the loop.

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

    Hi Dear,
    I am having a query, in User Define Type Arrays, I am using same code for Pivot H/L as you used in one of your video but I am facing a problem that i can use for loop to get the data set from array but if I need to fetch a specific array index value, then i am not able to get it.
    For example in the same code, if I need to fetch a value of array index 10 for levels but i don't want time value so how can i get it.
    Presently I am using UDT Arrays for Levels and RSI and want to extend for more use but because of this problem i am unable to process further so please help me.

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

    I'm in your Mastery Course. I just did this tutorial and I am confused after trying out the code. When you click on a individual bar using the bartime code it still just gives you the data from the very last bar no matter where you click on the chart.(Even your thumbnail shows the issue with the 2 Labels showing the exact same list of numbers even though they are referencing 2 different bar times) Could you verify there isn't a bug in the code? Otherwise, great product. This is the only instance I found anything odd about your code. Also on Part 2 the link to the script you reference does not work.

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

    Hi
    Please make a tutorial on stepped stop loss, where after achieving TP 1 stop loss moves to breakeven, and after TP2 , stop loss moves to TP 1 and so on,,.......... Would be highly obliged. Thanks

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

    Can we reset the the input values whenever user change the symbol..... I have indicator and I am inputting values bases on 1 symbol but I want to change the values to 0 whenever user change the symbol

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

    gold! thank you 🤝

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

    Hi, thanks for the video.
    i have write a comment but for any reason is ot available.
    Please check this functionality that could be usefull for debuging. it was introduce last july
    The display parameter supports the addition and subtraction of its arguments:
    display.all - display.status_line will display the plot’s information everywhere except in the script’s status line.
    display.price_scale + display.status_line will display the plot in the price scale and status line only.

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

      Thanks Walduss! Was not aware of that new parameter, that's extremely useful, I'll make sure to use that in future videos!

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

    Great video!!!❤

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

    can u plz code this for me...... SELL = If ema(10) value of last bar > previous bar's value , BUY = if ema(10) value of last bar < previous bar and the plot it

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

    Actually, there is using: display = display.data_window

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

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

    Hello sir I am kishore From India 🇮🇳 Sir I really want to learn about untouch pivot level to extend. Right how to plot. Untouch pivot level sir plz can u make 1 video on this 🙏

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

    Hello I try to debugging individual bar but I can't get the bar I select it always get the last bar.
    here the code I hope someone can help me
    ```pinescript v5
    // Add this script on a "5" minute chart
    //@version=5
    indicator("Debug Bar", overlay=true)
    //debuggin for specific bar
    int barTime = input.time(title = "select bar", defval=-1, confirm = true)
    //debugging for specific bar
    if barstate.islast and barTime != -1
    debug_str := "Bar Time: " + str.tostring(barTime) + "
    Open: " + str.tostring(open) + "
    High: " + str.tostring(high)
    test = label.new(x=barTime, y=na, text=debug_str, color=color.black, textcolor=color.white, textalign=text.align_left, xloc=xloc.bar_time, yloc=yloc.abovebar)
    ```

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

    that was awsome

  • @gleventis1
    @gleventis1 3 місяці тому

    Nothing to do with debugging

  • @biodigital_jaz
    @biodigital_jaz 3 місяці тому

    This is the worst debugging experience I have ever seen in a coding language....the developers should really just release a debugger in the IDE....

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

    hi brother video is awesome I need little bit of help from you
    I want to plot horizontal line from particular date and particular price and particular price, right extended not left
    I tried but its not working pls check
    //@version=5
    indicator("time_price ",overlay = true)
    // Define the start date and price for the line
    start_date = timestamp("2022-01-01 00:00:00")
    price = 1140
    // Calculate the number of bars since the start date
    bars_since = ta.barssince(start_date)
    // Draw the horizontal line
    line.new(x1=bar_index[bars_since], y1=price, x2=bar_index, y2=price, color=color.blue)