Overall Statistics
import numpy as np
import decimal as d
from datetime import timedelta, datetime

class FirstProject(QCAlgorithm):

    def Initialize(self):

        self.SetCash(100000)
        self.SetStartDate(2018,7,1)
        self.SetEndDate(2018,7,3)
        self.SetBrokerageModel(BrokerageName.OandaBrokerage)
        self.SetWarmUp(timedelta(days=1))
        
        self.AddForex("EURUSD", Resolution.Minute, Market.Oanda).Symbol
        self.HA = HeikinAshi("EURUSD")

        #rolling windows for actual price
        self.price_window = RollingWindow[QuoteBar](10)
        #rolling window for HA indicator 
        self.HA_open_win = RollingWindow[d.Decimal](10)
        self.HA_close_win = RollingWindow[d.Decimal](10)
        
        #Consolidate Heiken Ashi
        fiveMinuteConsolidator = QuoteBarConsolidator(timedelta(minutes=5))
        fiveMinuteConsolidator.DataConsolidated += self.OnDataConsolidated
        self.SubscriptionManager.AddConsolidator('EURUSD', fiveMinuteConsolidator)
        self.RegisterIndicator('EURUSD',self.HA,  fiveMinuteConsolidator)
        

    def OnData(self, data): 
        if not (self.HA.IsReady): return

        
    def OnDataConsolidated(self, sender, data):
        if not (self.HA.IsReady): return

        self.price_window.Add(data)
        self.HA_open_win.Add(self.HA.Open.Current.Value) 
        self.HA_close_win.Add(self.HA.Close.Current.Value)

        if not (self.price_window.IsReady):return
        if not (self.HA_open_win.IsReady):return
        if not (self.HA_close_win.IsReady):return
        
  
        self.Log(self.price_window[0].Ask.Close) 
        self.Log(self.HA_open_win[0])