I'm testing a hypothesis I have about the market but wanted to see if anyone would be willing to collaborate in order to see if this concept can be shown for at least a specific set of circumstances to be generally true. I am on the spectrum and new to a lot of this, but have tenacity as well as a passion for learning to make numbers go up.
I think it works because CNHUSD hadnt been released yet and that if there could be an empty placeholder for the entry of CNHUSD for Oanda the algorithm could work more generally. How would I do this? Am I wrong?
Any and all assistance is most welcome.
Here's the python code:
import random
class WellDressedAsparagusLeopard(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2002, 5,31) # Set Start Date
self.SetCash(100000) # Set Strategy Cash
#self.AddEquity("SPY", Resolution.Tick)
#self.AddEquity("SPDN", Resolution.Tick)
#self.AddEquity("BND", Resolution.Tick)
self.AddForex("EURUSD", Resolution.Tick, Market.Oanda)
self.AddForex("CNHUSD", Resolution.Tick, Market.Oanda)
self.AddForex("USDEUR", Resolution.Tick, Market.Oanda)
self.SetWarmUp(1)
self.IsWarmingUp
def OnData(self, data: Slice):
'''OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.
Arguments:self.AddEquity("BTC", Resolution.Minute)
data: Slice object keyed by symbol containing the stock data
'''
#self.AddForex("EURUSD", Resolution.Tick, Market.Oanda)
#self.AddForex("USDEUR", Resolution.Tick, Market.Oanda)
#self.AddForex("CNHUSD", Resolution.Tick, Market.Oanda)
#self.SetWarmUp(1)
#self.IsWarmingUp
# Make 100 trials.
n_tries = 1
# Lists to store results from stay and switch stratey
switch_results = []
for i in range(n_tries):
doors = ["EURUSD","USDEUR"]
random.shuffle(doors)
switch_result = doors[0]
switch_results.append(switch_result)
for i in range(n_tries + 1):
# Same code as above, for one trial
doors = ["EURUSD","USDEUR", "CNHUSD"]
random.shuffle(doors)
switch_result = doors[2]
del doors[1:2]
switch_result = doors[0]
# Put results into result lists
switch_results.append(switch_result)
if self.Portfolio.Invested:
for i in range(n_tries):
self.SetHoldings(switch_result, 0.01)
for i in range(n_tries +2):
self.Liquidate(switch_result)
else:
# Lists to store results from stay and switch strategy
if not self.Portfolio.Invested:
for i in range(n_tries):
self.SetHoldings(switch_result, 0.01)
A. E. Fagan
I call this algorithm where there is an applied monty hall experiment with an empty entry “The Fagan Formula” ;)
Louis Szeto
Hi A. E. Fagan
USD-Offshore China RMB pair is available in Onada exchange with symbol USDCNH.
I'd say Monty Hall is only for equal-chance uncorrelated events/objects, and there wasn't any elimination process in the market!
Best
Louis
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.
A. E. Fagan
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!