I am creating an algorythm that buys a stock if it cross a high and its following 5min candle closes above that high. I ran a backtest and went to that day. My fill prices arent even on the chart?
The basis of my algo is that I create a rolling window for the 5min candle and use the highs for my resistance levels. Since I consolidated the data on the 1min for my rolling window will that effect my high values?
Any help would be greatly appreciated!
Fred Painchaud
Hi Brady,
What do you mean by “my fill prices are not even on the chart"?
Are you surprised they are not? Are you looking at the QC chart or the TV chart in that remark?
Your algo subscribe to minute data so OnData will be called every minute. Your rolling window contains consolidated 5mins bars (2). And you max values are for the last 5 days. So you compare the last 5mins to the last 5 days highest high. Those comments are to help you with your question “Since I consolidated the data on the 1min for my rolling window will that effect my high values?”. Your high values are for 5 days so they are not affected by your consolidator.
I don't understand why you divide your percentage parameters by 1000 instead of 100.
That aside, I don't see a problem with that algo. Would you please elaborate a bit more on the issue you want help with? I will be glad to help you then!!
Fred
Brady Murakami
Hey Fred, thanks for the response! Very new to coding so some my methods are probably off (since the weekend)
For the percentages, I couldn’t get decimal values to work so that was the easiest solution for me.
Thats great to hear that the algo is doing what I specified!
Now the fill price, maybe I should have been more specific but it relates to my fill prices on stop orders. If you look at the backtest it says that my limit order is sent then immediately after my stop loss triggered. When I look at the chart on that day, the stop never should not have been triggered because the price never dropped to that level. I am looking at the TradingView chart as I am having troubles getting the charts to work on Quantconnect.
My chart issues are I can’t get the actual MSFT chart to show in bars and also it comes back saying I don’t have enough data for the chart range I specified.
Fred Painchaud
Hi Brady,
I did not do a full analysis on this yet but yes I finally did spot what you were referring to. And it got me wondering 😊…
The fact that you only trade during a single minute everyday (9h36) made me wonder if something jazzy was not happening with the logs there as, yes, as you are saying, the fill price of your first stop loss should not be met at 9h36 on Dec 10th.
So I added a line of code to log the time when the stop loss actually gets filled since from the chart, it looked like your market order DOES get held for a while…
I got this: 2021-12-14 09:51:00
So basically, what happens is the following:
Fred
Brady Murakami
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!