Algo Trading. How to place stop loss on NIFTY? Fyers , Python
Placing stop loss
lossType=risk.get()
if(lossType==1):
if(checkBank()):
exitOrder()
break
elif(lossType==2):
if((ltp-float(avgPrice.get()))<(-int(spin2.get()))):
exitOrder()
break
def checkBank():
data = {"symbols":"NSE:NIFTY50-INDEX"}
out=fyers.quotes(data)
ltp=out["d"][0]["v"]["lp"]
if((strikeName.get().endswith("CE"))and(ltp<=int(spin1.get()))):
return 1
elif((strikeName.get().endswith("PE"))and(ltp>=int(spin1.get()))):
return 1
Comments
Post a Comment