Overall Statistics
Total Trades
0
Average Win
0%
Average Loss
0%
Compounding Annual Return
0%
Drawdown
0%
Expectancy
0
Net Profit
0%
Sharpe Ratio
0
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
0
Beta
0
Annual Standard Deviation
0
Annual Variance
0
Information Ratio
0
Tracking Error
0
Treynor Ratio
0
Total Fees
$0.00
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
# 
# Licensed under the Apache License, Version 2.0 (the "License"); 
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from datetime import datetime, timedelta

from clr import AddReference
AddReference("System")
AddReference("QuantConnect.Algorithm")
AddReference("QuantConnect.Indicators")
AddReference("QuantConnect.Common")

from System import *
from QuantConnect import *
from QuantConnect.Algorithm import *
from QuantConnect.Indicators import *
from QuantConnect.Data.Market import *


class CustomChartingAlgorithm(QCAlgorithm):
	def __init__(self):
		self.__bollinger = None
		self.__symbol = "AUDUSD"
		self.__resolution = Resolution.Hour

	def Initialize(self):
		self.SetCash(100000)
		self.SetStartDate(2015,6,24)
		self.SetEndDate(2015,6,26)
		self.AddForex(self.__symbol, resolution=self.__resolution)
		
		self.__bollinger = self.BB(self.__symbol, 120, 2, MovingAverageType.Exponential, resolution=self.__resolution)
		
		#Chart - Master Container for the Chart:
		stockPlot = Chart("Trade Plot")
		lowerBand = Series("lowerBand", SeriesType.Line, 0)
		middleBand = Series("middleBand", SeriesType.Line, 0)
		upperBand = Series("upperBand", SeriesType.Line, 0)
		audusd = Series("AUDUSD", SeriesType.Candle, 0)
		stockPlot.AddSeries(audusd)
		# stockPlot.AddSeries(lowerBand)
		# stockPlot.AddSeries(middleBand)
		# stockPlot.AddSeries(upperBand)
		self.AddChart(stockPlot)

	def OnData(self, data):
		'''On receiving new tradebar data it will be passed into this function. The general pattern is:
		"public void OnData( CustomType name ) {...}"
		Arguments:
			data: Slice object keyed by symbol containing the stock data
		'''
		if not data.ContainsKey("AUDUSD") or data["AUDUSD"] is None:
			return

		# self.Plot("Trade Plot", "lowerBand", self.__bollinger.LowerBand)
		# self.Plot("Trade Plot", "middleBand", self.__bollinger.MiddleBand)
		# self.Plot("Trade Plot", "upperBand", self.__bollinger.UpperBand)
		self.Plot("Trade Plot", "AUDUSD", data["AUDUSD"].Price)