-
-
Save zachlim98/701542cabfcf0c5e66cf405bbe830c83 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for i in range(0,len(data)): | |
if data["Pos"][i-1] == 0: | |
if data["RSI"].iloc[i] > 50 and data["MACD_diff"][i] > 0 and (data["Pos"][i] == 0): | |
data["Buy_Signal"][i] = 1 | |
data["Pos"][i] = 1 | |
data["SL"][i] = (data[ticker][i]*0.97) | |
data["TP"][i] = (data[ticker][i]*1.5) | |
elif data["RSI"].iloc[i] < 50 and data["MACD_diff"][i] < 0 and (data["Pos"][i] == 0): | |
data["Buy_Signal"][i] = 1 | |
data["Pos"][i] = -1 | |
data["SL"][i] = (data[ticker][i]*1.03) | |
data["TP"][i] = (data[ticker][i]*0.95) | |
else: | |
data["Buy_Signal"][i] = 0 | |
data["Pos"][i] = 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment