Overall Statistics
import pandas as pd
from datetime import timedelta

class Calibrated(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2019, 4, 1)  # Set Start Date
        self.SetEndDate(2019, 4, 30)  # Set End Date
        self.SetCash(2500)  # Set Strategy Cash
        self.AddForex("EURUSD", Resolution.Minute, Market.Oanda)
        self.Securities["EURUSD"].SetLeverage(100.0)
        self.soft_entry = 0.0000
        self.n_min = 20
        self.or_l = 1000
        self.or_h = 0
        self.or_t = 0
        self.llo = 0
        self.slo = 0
        
        
        
    def OnData(self, data):
        '''OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.
            Arguments:
                data: Slice object keyed by symbol containing the stock data
        '''
        cur_t = data["EURUSD"].Time
        cur_d = cur_t.date()
        cur_h = cur_t.hour
        cur_m = cur_t.minute
        
        if(cur_m <= self.n_min):
            if(data['EURUSD'].Low<self.or_l):
                self.or_l = data['EURUSD'].Low
            if(data['EURUSD'].High>self.or_h):
                self.or_h = data['EURUSD'].High
            
        
        if(cur_m == self.n_min): 
            self.or_t = self.or_h - self.or_l
            #long limit order
            self.llo = self.LimitOrder('EURUSD',1000,round(self.or_l,5) - self.soft_entry,"limit order below OR")
            #short limit order
            self.slo = self.LimitOrder('EURUSD',-1000,round(self.or_h,5) + self.soft_entry,"limit order above OR")
           
          
          
          
          
          
                
#eof