0

Is it possible to set up a trading strategy in R using one Symbol (for example QQQ) to generate Signals but buy/sell another Symbol (for example QLD) ?

The tradingstrategy with the QQQ is already made, how can i include the quotes of the QLD for buying and selling when a signal with the QQQ-quotes occur?

Thank you for your help?

FXQuantTrader
  • 6,821
  • 3
  • 36
  • 67
Ramon
  • 71
  • 8

1 Answers1

0
  • Merge on the QLD OHLC data (or QLD tick data if available) to an xts object which contains the QQQ indicators and signals.

  • Use na.locf where necessary to fill forward price data.

  • Treat this merged object as one symbol in quantstrat (and add other pairs of data in other symbols if you wish), even though the price data is for QLD, and the indicators are for QQQ.

  • When you get an entry signal in your QQQ market data, you will can execute on QLD prices, if you have a "Close" column in the data object, quantstrat will fill on that.

If these instructions don't make sense, make a full reproducible example for someone to help you with.

FXQuantTrader
  • 6,821
  • 3
  • 36
  • 67