Good Afternoon fellow developers
I'm quite new to Futures trading, and currently, I'm working on a project for a trading company in brazil to hedge their regular operations in the petrol industry by utilizing correlation coefficient to further understand and predict the direction of the USDBRL to facilitate the closing of exchange rates on their operations.
I have been using Quandl data from Nasdaq data Link, but due to its nature which is updated daily, I can't get a precise understanding of the nature of this operation I'm trying to perform.
This is Code I will share below am just trying to add “6L” data to my algorithm with SMA.
Any help is greatly appreciated, I look forward to sharing the complete project involving CFD, Interest Rates, and Forex and Futures.
Thank You
class MuscularSkyBlueLeopard(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2022, 5, 10) # Set Start Date
self.SetCash(100000) # Set Strategy Cash
#self.AddForex("CADJPY", Resolution.Hour)
#self.smaFast = self.SMA("CADJPY", 4)
#self.smaSlow = self.SMA("CADJPY", 30)
self.AddFuture("6L",Resolution.Hour )
future = self.AddFuture(Futures.Currencies.BRL)
future.SetFilter(timedelta(30), timedelta(182))
#self.smaBrazilFast = self.SMA(future, 30)
#self.smaBrazilSlow = self.SMA(future, 200)
#-------------#USDBRL------------------------------------------------------
#self.quandlCode_Brazil_USDBRL="FED/RXI_N_B_BZ"
#self.AddData(QuandlCustomColumns, self.quandlCode_Brazil_USDBRL, Resolution.Minute, TimeZones.NewYork)
#self.smaBrazilPrice = self.SMA(self.quandlCode_Brazil_USDBRL, 1)
#self.smaBrazilFast = self.SMA(self.quandlCode_Brazil_USDBRL, 30)
#self.smaBrazilSlow = self.SMA(self.quandlCode_Brazil_USDBRL, 200)
def OnData(self, slice):
for chain in slice.FutureChains.Values:
contracts = chain.Contracts
for contract in contracts.Values:
pass
#if self.smaBrazilFast.Current.Value > self.smaBrazilSlow.Current.Value:
#self.SetHoldings("CADJPY",-0.1)
#else:
self.SetHoldings(future,1)
self.Plot("CADJPY","CADJPY", self.Securities["CADJPY"].Price)
self.Plot("CADJPY", "CADJPY Fast", self.smaFast.Current.Value)
self.Plot("CADJPY", "CADJPY Slow", self.smaSlow.Current.Value)
#self.Plot("PAIR","USDBRL", self.Securities["6L"].Price)
#self.Plot("PAIR", "USDBRL Fast", self.smaBrazilFast.Current.Value)
#self.Plot("PAIR", "USDBRL Slow", self.smaBrazilSlow.Current.Value)
#--------------------Import collumns----------------------------------------------------
class QuandlCustomColumns(PythonQuandl):
def __init__(self):
self.ValueColumnName = "Value"
Varad Kabade
Hi Luis,
To use indicators with futures, we need to create an indicator on individual contracts in which we are interested. Refer to the following example algorithm for more information.
Best
Varad Kabade
Luis roldan
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!