Hi,

I am trying to write a strategy that works on multiple securities with the same strategy. Using the MACD-indicator on four different securities and if one of the four fits the condition, I want to buy an option for that security.

But everything one of the securities fits the condition, I buy options for all four securities instead of only one. 

How do I select only the right security that fits the condition the entry a trade?

  1. for symbol, macd in self.macd.items():
  2. if macd.Current.Value < 0.5:
  3. for symbol in self.symbols:
  4. for kvp in data.OptionChains:
  5. if kvp.Key == symbol:
  6. chains = kvp.Value
  7. self.BuyCall(chains)

Author

Alex Veraart

October 2022