Hi:

I'm trying to create this code, but after reading documentation and tutorials, it seems that I'm missing something. Code is built but no single spread is bought, so I would thank some help. 

This is my initialization

def initialize(self):
        self.set_start_date(2019, 1, 1)
        self.set_end_date(2019, 4, 1)
        self.set_cash(100000)


        index = self.add_index("SPX", Resolution.HOUR).symbol
        option = self.add_index_option(index, "SPXW", Resolution.HOUR)
        option.SetFilter(-120, +10, 60, 80)
        self._symbol = option.symbol

What I want to do is use the combo_limit_order to buy 1 spread every Monday with the following characteristics:

  • The expiration date must be between 78 and 84 DTE
  • The BullPut spread must be 20 points wide
  • The short Put strike must be 80 points below the underlying. The long Put strike must be 100 points below the underlying
  • The bullput spread must be closed when 35 days before expiration

 

How could I create this?

Thanks