Overall Statistics
import pandas as pd
from datetime import datetime
from collections import deque

class QCAlgorithm(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2018, 3, 1)  
        self.SetEndDate(2018, 5, 1)  
        self.SetCash(5000) 
        self.AddForex("EURUSD", Resolution.Hour, Market.Oanda)

        self.fast = self.EMA("EURUSD", 10)
        self.slow = self.EMA("EURUSD", 15)
        self.previous = None
        
        self.rsi = self.RSI("EURUSD", 14,  MovingAverageType.Simple, Resolution.Hour)
        self.sto = self.STO("EURUSD", 15, 3, 3, Resolution.Hour)

    def OnData(self, data):
        if not (self.fast.IsReady and self.slow.IsReady): return
        if not (self.rsi.IsReady and self.sto.IsReady): return
        if not self.Portfolio["EURUSD"].IsLong:
                if self.fast.Current.Value > self.slow.Current.Value:
                    if self.rsi.Current.Value > 40 and self.rsi.Current.Value < 80:
                            if self.sto.Current.Value > 20 and self.sto.Current.Value < 90:
                                    self.MarketOrder("EURUSD", 1000)

        if self.Portfolio["EURUSD"].IsLong and self.fast.Current.Value < self.slow.Current.Value:
            #self.Log("SELL >> {0}".format(self.Securities["EURUSD"].Price))
            self.MarketOrder("EURUSD", -1000)
        self.previous = self.Time