Complete Newb asking for help creating a backtest code
Forums › ProRealTime English forum › ProBuilder support › Complete Newb asking for help creating a backtest code
- This topic has 5 replies, 3 voices, and was last updated 1 year ago by coincatcha.
-
-
05/10/2023 at 9:06 AM #214446
This is my very first post here,so not sure if I am allowed to ask the following?
I literally downloaded and installed PRT today after I discovered my broker IG offered it to traders who trade regularly. Then after watching a few help videos I discovered there was a backtest function.
Awesome I thought.
I started to play with it, but in the short time I did, I figured since I don’t have a clue how to write code, I could only use the simplified method which i think can only rely on indictaors that are on the charts. ie:I click on an indicator and it pops up a window where I can change some paremeters. This doesn’t work for me as It’s more Price action that I trade as I describe below.
Trading the opening of the various Indicies can be be quite profitable with some discipline. I do lack it at times and come unstuck unfortunately.But that’s for another day.
I have learnt a few scalping trades from pros over the years that revolve around taking a break of the opening 5 min candle or a preopen candle on several of the indexes .Then trading bar length or trading it to a certain ATR value then exiting.
I have scrolled through many many charts and manually written down my findings which confirm what I have described above. But because this is so time consuming I don’t have as big a data set as I would like.
I was hoping someone might be able to create some code so I can do a deeper dive into these?
If it is ok to ask this here and you are happy to help that would be great. Thank you and let meknow and I will do my best to acuratlely define my parameters.
at base level i would need to be able to specifically test the open candle or preopen candle, change timeframes and only enter long or short once the candle has been broken by so many pips, which should also be variable.Cheers
Greg05/10/2023 at 9:40 AM #214450The simplified method can be used for Screeners, Indicators and Strategies.
As that name reminds, it will allow non-programmers to accomplish some easy tasks which do not involve programming.
You may ask all you need, but it’s beyond the goal of this forum (and beyond the available time of any of us users, moderators and coders) to teach programming from scratch.
You should try to learn the very basic principles and skills of coding (no need to know complex instructions, nor data structures and data). It shouldn’t take long to get the hang of it, provided you have some hours of your time to spend learning. Maybe you have friends who can help you or you may read some of the tons of examples on this forum.
Once you know the difference among variables, constants and arrays and have learned what FOR..NEXT and IF…ENDIF are,well… you are ready to ask how to build some effective code.
A good start is the manual at https://www.prorealtime.com/en/help-manual/quick-tour.
1 user thanked author for this post.
05/10/2023 at 11:44 AM #214458This is exactly how I trade manually too.
12 months ago I decided to start going into fully automated trading from scratch looking for these set-ups. After 6 weeks of really deep diving into PRT mostly with the wizard I came up with 4 pairs of mean reversion opening drive scalps. The goal here was to use the account across multiple opening drives each day.
My ftse MR short bot was only just filtered out of this move tonight, which is fine. A train leaves the station everyday.
In short though, I encourage you to explore this as I am also a price action scalper. Be mindful that it is no small undertaking. Sure, you can find these trades but will soon learn the limitations of a 5 month data set on a 1 min chart. You say 5 min so that is better and the strategies should be more robust.
It’s a very long endless road but very rewarding. After running up 170% in 3 months and back down to 80% (from maxing out the account nearly every trade) I decided this is only part of how I wanted to trade to meet my goals and largely spend time diversifying into higher TF’s and learning more code. Ideas as a PA trader ideas are not hard to come by, finding them through code is not too difficult either. But awaiting live data samples and making these types of trades easy to live with is much more refined work. It may not look how you’d first thought by the time you’ve done this, and you won’t be the same trader you are now. You’ll be a far more sophisticated scalper with statistics to back up your executions.
If I can give you one hot tip, yes you can point and click to make these scalps into auto bots. The best and least optimised ones seem to have a direction filter, and no more than 2 triggers and can have basic trade management. So no more than 3-5 conditions, otherwise they’ll barely run and you won’t have a statistically significant sample size which would mean you are looking for trouble and might just find it!
As it stands one year on, about half of my algorithms survived and are the bones of my portfolio albeit often with a minor mod. The bonus is I have now run them through many market structures and have more data than I can visually see in a back test = pure gold. But you are looking in the right place. You can maximise an account and barely be in market more than 1% of the day because time of day is critical to these scalps. I truly believe the reason I survived my first year auto trading was because I was already profitable as a manual trader. I think it should be a pre-requesite.
When you get this far down the rabbit hole you will then have the balls to trade the Hang Seng where you can swing from the rafters once you discover that opening drives can be 100-300 points!
All the best, you have some work to do! But remain patient..always as the hours involved (for me at least) are/have been huge in the early stages.
1 user thanked author for this post.
05/11/2023 at 3:20 AM #214488Thanks for the encouragement coincatcha
I want to continue to trade it manually.
I’m just looking for an automated way of testing it.I believe when Price action trading, some level of discretion is warranted
and as i stated above I have no training in coding, so have no idea if that“discretion” can be coded into a back testing system.
btw I see your avatar has an aussie flag? or is it a kiwi flag, bit too hard to see
for my sorry eyes. Where are you based? if you are happy to share?
Cheers
Greg05/11/2023 at 3:21 AM #21448905/11/2023 at 5:19 AM #214490Yep no worries. That’s Oz ..Toowoomba/Brisbane for me.
‘Coding in’ discretion by nature will some what fool the data you are trying to extrapolate. It can be done through optimizing variables to give you a range in which an entry/exit may still be statistically viable. I think this is what your referring to?
In your example, the UK open reverted but the price action leading up to it was enough to tilt any short term trends to the upside (instos/MM’s setting it up). So it was a false break (I haven’t looked at any S/R lines to be sure) but this is basically the price pattern. The candle set-up for this is nearly always something like 3-5 closes lower than the high, with price above a 5min 200ema or similar for mean reversion. I use 1000ema on a 1 min. Volume can be a second trigger.
So…you could easily use the Wizard to check for a range of parameters to work with manually if you are so inclined. For me, I have found that Ftse shorts need to work in the first 60-90mins. Long scalps 30mins and both are invalid if they don’t have a supporting volume push. Not so on Xjo. Some indices you’ll see that the results are the opposite. In my experience so far I treat Ndq and Hk50 in a similar manner, then Xjo and Ftse with a similar set of rules.
Once you know your odds better you may find it harder initially to place a trade though because you’ll realise how far against the odds you were playing. Manually I had a very high win rate of 87-91% with a single outsized loss once a month. I was producing 40% per month for 6 months straight before I acknowledged the Elephant in the room was just getting bigger and I had to do something about my risk problem. This is the main reason I went auto.
Testing my Heiken Ashi entry for reversion was a poor 28%, on-trend 48% and I can’t remember reversion against resistance which was my actual set-up but it was closer to 50%.
You’ll find what your after and maybe something more!
ATB
-
AuthorPosts
Find exclusive trading pro-tools on