def endup(k, start, bccc, top_bccc, sd_bccc, bccadx): notinup = 0 if bccc[k] <= stoploss * max(bccc[start:k]): return k if bccc[k] / bccc[k - 3] > stopprofit: #or bccc[i]/bccc[start]>1.05: return k notinup = 0 for j in range(start + 3, k): if bccc[j] > top_bccc[j] * theta and findtheta( bccc[j - thetaback:j] ) >= bolling_bar and sd_bccc[j] >= bolling_sd and bccadx[j] >= adxbar: notinup = 0 else: notinup = notinup + 1 if notinup >= back: return k if bccc[k] <= bot_bccc[k] * bot_bar: return k return 0
def godown(k, bccc, bot_bccc, sd_bccc, bccadx): if bccc[k] < bot_bccc[k] * (2 - theta1) and findtheta( bccc[k - thetaback1:k] ) <= -bolling_bar1 and sd_bccc[k] >= bolling_sd1 and bccadx[k] >= adxbar1: return k return 0
def goup(k, bccc, top_bccc, sd_bccc, bccadx): if bccc[i] > top_bccc[k] * theta and findtheta( bccc[k - thetaback:k] ) >= bolling_bar and sd_bccc[k] >= bolling_sd and bccadx[k] >= adxbar: return k return 0