[Python] How would you translate this Pine Script nested loop into Python?

Discussão em 'Python' iniciado por Stack, Junho 27, 2025.

  1. Stack

    Stack Membro Participativo

    I'm new to Pine Script and I've been struggling to understand the logic behind the if/else Pine Script's operators. I can understand all the simple examples that I could find online, but when it comes to the particular code I want to translate into Python, it becomes more difficult. Here is the nested loop I'm struggling to understand:

    hi:=hi[1]?high[1]>=stop[1]?false:true:low[1]<=stop[1]?true:false
    stop:=hi?max1:min1
    stop:=hi?hi[1]==false?stop:stop>stop[1]?stop[1]:stop:hi[1]?stop:stop<stop[1]?stop[1]:stop


    As I've mentioned before my goal is to translate this snippet of code into Python. Thank you guys for help!

    P.S. this is Pine Script v4

    Continue reading...

Compartilhe esta Página