Can someone please show me how to place a trade to Buy/Sell using Forex instrument With
- buy if
- the price is the highest price for the past 3hrs (or for simplicity, on the same day) &
- 1 minute candlestick had started above 20 minute-EMA and finished below 20 minute-EMA &
- the next 1 minute candlestick also started above 20 minute-EMA and finished below 20 minute-EMA
- sell if
- when the loss is 10 pips or
- the profit becomes 25 pips
I can do only easy part as below:
def Initialize(self):
self.SetStartDate(2020, 1, 1) #Set Start Date
self.SetEndDate(2021, 1, 31) #Set End Date
self.SetCash(10000) #Set Strategy Cash
pairs = ["EURUSD", "GBPUSD", "AUDUSD", "NZDUSD","EURGBP"]
self.forexPair = "EURUSD"
self.AddForex(self.forexPair, Resolution.Minute, Market.Oanda)
I would really appreciate it because It has been one of the items on my bucket list in the past 14 years.
Shile Wen
Hi Yongmin,
For the highest price in the past 3 hours, I suggest using the MAX indicator. Furthermore, to tell if a 1 minute candlestick starts above then finished below, I suggest using the Open and Close fields of a QuoteBar. Furthermore, please see these docs on how to use basic indicators, and feel free to replace the RSI with an EMA. Furthermore, for the stop loss and take profits, I suggest looking at our Orders docs.
Best,
Shile Wen
Yongmin
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!