Overall Statistics Total Trades71Average Win0.39%Average Loss-0.23%Compounding Annual Return-47.029%Drawdown2.400%Expectancy-0.105Net Profit-1.039%Sharpe Ratio-9.71Loss Rate67%Win Rate33%Profit-Loss Ratio1.69Alpha-0.614Beta5.387Annual Standard Deviation0.054Annual Variance0.003Information Ratio-10.032Tracking Error0.054Treynor Ratio-0.097Total Fees\$0.00
```### <summary>
### Simple RSI Strategy intended to provide a minimal algorithm example using
### one indicator
### </summary>
import time
import matplotlib.pyplot as plt
from System import *
from QuantConnect import *
from QuantConnect.Algorithm import *
from QuantConnect.Indicators import *
from datetime import datetime
from System import *
from QuantConnect import *
from QuantConnect.Data.Consolidators import *
from QuantConnect.Data.Market import *
from QuantConnect.Orders import OrderStatus
from QuantConnect.Algorithm import QCAlgorithm
from QuantConnect.Indicators import *
import numpy as np
from datetime import timedelta, datetime
import pandas
import numpy as np
### <summary>
### Simple RSI Strategy intended to provide a minimal algorithm example using
### one indicator
### </summary>
class MultipleSymbolConsolidationAlgorithm(QCAlgorithm):

def Initialize(self):
'''Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.'''
# Set our main strategy parameters
self.SetStartDate(2015, 1, 1)
self.SetEndDate(2015, 1, 6)      # Set End Date
self.SetCash(10000)

self.Data = {}
ForexSymbols =["EURUSD", "GBPUSD", "USDCHF", "AUDUSD","NZDUSD"]
for symbol in ForexSymbols:
self.Data[forex] = SymbolData(forex, self)

def OnData(self,data):
for symbol in self.Data.keys():

class SymbolData(object):

def __init__(self, symbol, algorithm):
self.symbol = symbol
self.algorithm = algorithm
self.quant = 10000

self.pip_s = 5
self.tp = 33/10000
self.sl = 14/10000
self.price = 0
self.short = 0
self.long = 0
self.sl_s = 0
self.tp_s = 0
self.first_stg_up = 0
self.first_stg_down = 0

self.sma_f = self.algorithm.SMA(symbol, 20)
self.sma_s = self.algorithm.SMA(symbol, 7)
self.bars = RollingWindow[QuoteBar](20)

pip = (bar.High - bar.Low)*10000
currSma = self.sma_f.Current.Value
trend_sma = np.where(self.sma_f.Current.Value > self.sma_s.Current.Value,1,0)

if self.long == 0 and self.short == 0:
if not self.algorithm.Portfolio[self.symbol].Invested:
if  bar.Close > bar.Open:
self.first_stg_up = 1

if self.first_stg_up == 1:
self.first_stg_down = 0

if not self.algorithm.Portfolio[self.symbol].Invested:
if pip >self.pip_s and bar.Open < bar.Close and self.trade_ind == 1 :
if  self.long == 0 and self.short == 0:
self.price = bar.Price
self.tp_s = bar.Price + self.tp
self.sl_s = bar.Price - self.sl
self.long = 1
self.algorithm.MarketOrder(self.symbol, self.quant)

if self.price > 0 and self.long == 1:

if bar.Price >= self.tp_s:
self.long = 0
self.algorithm.Liquidate(self.symbol)
if bar.Price <= self.sl_s:
self.long = 0
self.algorithm.Liquidate(self.symbol)```