namespace QuantConnect.Algorithm.CSharp
{
public class ModulatedTransdimensionalRegulators : QCAlgorithm
{
VolumeWeightedAveragePriceIndicator _vwap;
public override void Initialize()
{
SetStartDate(2018, 11, 13); //Set Start Date
SetEndDate(2018, 11, 30);
SetCash(100000); //Set Strategy Cash
AddEquity("SPY", Resolution.Daily);
// This adds a VWAP indicator, which will produce the volume-weighted average price
_vwap = VWAP("SPY", 1); // numeric argument 1 sets the VWAP to 1-day -- this can be adjusted for longer periods if desired
SetWarmUp(TimeSpan.FromDays(1));
}
public override void OnData(Slice data)
{
if (_vwap.IsReady){
Log("VWAP: " + _vwap.ToString());
Log("Close: " + data["SPY"].Close.ToString());
}
}
}
}