twopirllc / pandas-ta

Technical Analysis Indicators - Pandas TA is an easy to use Python 3 Pandas Extension with 150+ Indicators
https://twopirllc.github.io/pandas-ta/
MIT License
5.2k stars 1.01k forks source link

Leledc Exhaustion Bar indicator (Request) #614

Open kaanguven opened 1 year ago

kaanguven commented 1 year ago

This Pinescript code is really easy but I didn't even manage to set up a really simple for loop I guess because I was too tired :D Anyways

Can someone help me to convert this pine code to python?

maj_qual=input(6),maj_len=input(30)
min_qual=input(5),min_len=input(5)
maj=input(true,title="Show Major")
min=input(true,title="Show Minor")

lele(qual,len)=>
    bindex=nz(bindex[1],0)
    sindex=nz(sindex[1],0)
    ret=0
    if (close>close[4]) 
        bindex:=bindex + 1
    if(close<close[4]) 
        sindex:=sindex + 1
    if (bindex>qual) and (close<open) and high>=highest(high,len) 
        bindex:=0
        ret:=-1
    if ((sindex>qual) and (close>open) and (low<= lowest(low,len)))
        sindex:=0
        ret:=1
    return=ret

major=lele(maj_qual,maj_len)
minor=lele(min_qual,min_len)

Thank you !

01xRiverse commented 1 year ago

@kaanguven I could write this in python . Do you have any good source for the documentation of this indicator .

kaanguven commented 1 year ago

@kaanguven I could write this in python . Do you have any good source for the documentation of this indicator .

Only got this https://tr.tradingview.com/v/2rZDPyaC/

Codecapable commented 1 year ago

Has this been resolved? It would be really nice to have it in python.

tomjrtsmith commented 1 year ago

define the inputs

maj_qual = 6 maj_len = 30 min_qual = 5 min_len = 5 maj = True min = True

define the lele function

def lele(qual, len): bindex = 0 sindex = 0 bindex = nz(bindex[bindexSindex], 0) sindex = nz(sindex[bindexSindex], 0) ret = 0 if close > close[closeVal]: bindex += 1 if close < close[closeVal]: sindex += 1 if bindex > qual and close < open and high >= highest(high, len): bindex = 0 ret = -1 if sindex > qual and close > open and low <= lowest(low, len): sindex = 0 ret = 1 return ret

calculate the major and minor

major = lele(maj_qual, maj_len) minor = lele(min_qual, min_len)

plot the characters

if maj: if major == -1: plotchar(high, char='•', location=location.absolute, color=color.red, transp=0, size=size.large) elif major == 1: plotchar(low, char='•', location=location.absolute, color=color.lime, transp=0, size=size.large)

if min: if minor == 1: plotchar(high, char='x', location=location.absolute, color=color.red, transp=0, size=size.small) elif minor == -1: plotchar(low, char='x', location=location.absolute, color=color.lime, transp=0, size=size.small)

define the alert conditions

leledecMajorBullish = major == 1 ? low : na leledecMajorBearish = major == -1 ? high : na

leledecMinorBullish = minor == 1 ? low : na leledecMinorBearish = minor == -1 ?

kaanguven commented 1 year ago

define the inputs

maj_qual = 6 maj_len = 30 min_qual = 5 min_len = 5 maj = True min = True

define the lele function

def lele(qual, len): bindex = 0 sindex = 0 bindex = nz(bindex[bindexSindex], 0) sindex = nz(sindex[bindexSindex], 0) ret = 0 if close > close[closeVal]: bindex += 1 if close < close[closeVal]: sindex += 1 if bindex > qual and close < open and high >= highest(high, len): bindex = 0 ret = -1 if sindex > qual and close > open and low <= lowest(low, len): sindex = 0 ret = 1 return ret

calculate the major and minor

major = lele(maj_qual, maj_len) minor = lele(min_qual, min_len)

plot the characters

if maj: if major == -1: plotchar(high, char='•', location=location.absolute, color=color.red, transp=0, size=size.large) elif major == 1: plotchar(low, char='•', location=location.absolute, color=color.lime, transp=0, size=size.large)

if min: if minor == 1: plotchar(high, char='x', location=location.absolute, color=color.red, transp=0, size=size.small) elif minor == -1: plotchar(low, char='x', location=location.absolute, color=color.lime, transp=0, size=size.small)

define the alert conditions

leledecMajorBullish = major == 1 ? low : na leledecMajorBearish = major == -1 ? high : na

leledecMinorBullish = minor == 1 ? low : na leledecMinorBearish = minor == -1 ?

Yes, this is pinescript code :D we are looking for python

just-nilux commented 1 year ago

I've converted it to python and also build a dynamic version of leledc exhaustion bands :) Feel free to include it in pandas-ta! https://github.com/just-nilux/legendary_ta/

StartZer0 commented 8 months ago

I've converted it to python and also build a dynamic version of leledc exhaustion bands :) Feel free to include it in pandas-ta! https://github.com/just-nilux/legendary_ta/

Can you please share any instructions on how I can run this Python code on a chart? I tried to convert a dynamic version of the Leledc exhaustion band in Pine Script no success. I would appreciate your response.

twopirllc commented 8 months ago

@just-nilux

I've converted it to python and also build a dynamic version of leledc exhaustion bands :) Feel free to include it in pandas-ta!

Would be great if someone could edit it a bit for inclusion. 😎 Some of the methods with for loops will need njit wrapped functions for numba; some indicators on the development branch can be referenced there.

Kind Regards KJ