Could someone help with a logical scheme in for loop statement in Python? I try to be more clear: i want to build a for loop cycle where if a condition is TRUE i want to append the same value for the next cells until another condition become TRUE.
For example:
list = []
for i in range(1,len(close)):
# FIRST CONDITION:
if (close.fast_ema[i-1] < close.slow_ema[i-1] and close.fast_ema[i] > close.slow_ema[i]:
list.append(close.close[i]) # i want to append close.close[i] for al the next cells i (i+1, i+2,...)
#until the SECOND condition become TRUE.
# SECOND CONDITION:
elif if (close.fast_ema[i-1] > close.int_ema[i-1] and close.fast_ema[i] > close.slow_ema[i]:
list.append(close.close)
else: ecc....
I'm not a python expert and I hope I was clear enough. Thank you in advance, and if someone decide to help me I will be very grateful.
Aucun commentaire:
Enregistrer un commentaire