tesla = TA_Handler( symbol="2080", screener="ksa", exchange="TADAWUL", interval=Interval.INTERVAL_1_DAY ) def is_the_stock_maketgoals(idd_company): #breing data from databaze for last 2 close bullish candel return closecandel_for_last_2_bullish def is_sellingcandel_or_baying(opencandel,closecandel,highcandel,lowcandel): valofratio=abs(opencandel - closecandel) / (highcandel - lowcandel) # Define the minimum body ratio minBodyRatio = 0.55 # Identify bullish and bearish candles based on body ratio isBullishCandle = closecandel > opencandel and valofratio >= minBodyRatio isBearishCandle = opencandel > closecandel and valofratio >= minBodyRatio if isBullishCandle is True : return 1 # candel is bullish = baying elif isBearishCandle is True : return 2 # candel is bearish = selling else : return 0