Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Help, when using different indicators (RSI, BB, EMA...)

let's say you use different indicators and you want the trade to be excecuted when at least two of those indicators give you a buy signal.

how can you make it happen??

1 response

@The Don,

You may try something like this:

    sig = 0;  
    # ---------- MAC ----------  
    if  price > sma: sig += 0.5  
    if  price < sma: sig -= 0.5  
    # ---------- RSI ----------  
    if rsi[-1] > UB: sig -= 0.5  
    if rsi[-1] < LB: sig += 0.5  
    # ---------- BB -----------  
    if price > ubb:  sig -= 0.5  
    if price < lbb:  sig += 0.5      

    if sig > 0: wt_stk = 1.0  
    elif sig < 0: wt_stk = 0

    order_target_percent(stock, wt_stk)