Back to Community
Dynamic Pair Weighting using Bollinger Bands, RSI, and MACD as input.

Hello Quantopian,

I am trying to develop a pair balancing algo that uses market signals such as BB, MACD, and RSI to adjust the weights of two etfs using order_target_percent(symbol('symbol'), ??%).

Does anyone know how to have a dynamic order_target_percent? I want to increase the weight by 1% if it is within BB, has positive MACD, and an RSI below 70. It would also decrease the weight of the pair etf by the same amount.

Any help would be greatly appreciated!

Thank you!

1 response

store the weight as a variable and if it meets your conditions then increase the variable by .01. Call order_target_percent() after every move, if the weight is the same it won't order anything because it's a target function, it only orders the right amount of stock to get to the target every time you use it.