i want a def about pin pattern and i try coding and i type below:
def buypin (DF):
df=data.copy()
for i in range(len(data)):
if df.close[i]>=((df.high[i]-df.low[i])*0.75+df.low[i]) :
df["buypin"]=1
elif df.close[i]<((df.high[i]-df.low[i])*0.75+df.low[i]) :
df["buypin"]=0
return df ["buypin"]
data["buypin"]=buypin(data)
when ı run it "buypin" column is fiiled 1 it ignore 0. I am ensure formula is correct because i check that on excell but def is wrong but i cant figure out where is the problem.
thanks and with best regard