Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Consecutive Selling Signals

Hi ,

Much appreciated if anyone please give some advise

I am having one challenge , currently my strategy Bollinger bands for buy and sell as follows

Buying


> def populate_buy_trend():  
>     currency.loc[  
>     (  
>             (currency['rsi']>30) &  
>             (currency["tradePrice"]<currency['bb_middleband']*(1-0.0012))  
>      ),  
>     'direction']=1  
>     return currency

Selling

> def populate_sell_trend():  
>        currency.loc[  
>         (  
>                 (currency["tradePrice"]>=currency['bb_middleband']*(1+0.0025))  
>         ),  
>         'direction']=0  
>         return currency  

For some specific time period I am getting consecutive selling signals for a specific entry , how can I ignore the second ,third and fourth exits in order to just pick first one to exit? I highlighted spot in green color below

Bollinger Bands

I just want to pick first one as shown ticked marked below in following fig

Raw Data

Regards

Khurram