There's no template per se, but I use the scientific method. Make sure the EA, and all the testing during development, is about the strategy and factual. Generally speaking, I don't even back test as there's too many ways to screw that up, simplest example is if you use OHLC data. Let's say you use 1H timeframe, open at 1.0 close at 2.0 to keep it simple. The hour starts at 1.5, 15 minutes later you have news. Price spikes to 2.2 and over the next ten minutes it hits 0.8 before settling on 1.5 again at close. How does the back test know which price got hit first? ... it doesn't know. For the back test that trade will continue as if that event didn't happen at all. You're far better off running hundreds of forward tests with demo accounts at that's only one of many ways a back test can get screwed up, bad data is another because how do you even know the computer is using good data? Unless you go in and check for all you know there's tons of gaps. Shoot, price could be entirely wrong and you'd never know unless you go in and check that there's a reasonable match (it won't' match exactly due to the OTC nature of FX).
Your problem isn't using ATR for SL and TP values; it's you didn't do the research and development. You're "thinking of putting aside my current approach". Why? You shouldn't be THINKING about anything. Any decision you make should be backed up with hard numbers to support the decision. There is no room for your opinion when making an EA. Did you try different ATR values side by side? Multiple accounts, same strategy, changing only ONE thing at a time.
And you're using optimization to "see if it can be profitable or not". Nope nope nope. Stop that truck right there. No. You can give me literally ANY strategy and I can show you it makes money. I'll just let the computer search and search until it finds some exact scenario where it just happened to work and be profitable. That's all you're doing. You're wasting your time.
Question for you: Do you know what the difference is between "tick data" and "tick data based on real ticks" when back testing/optimizing? If you don't, you're again wasting your time. There's a simple explanation on Tick Data Explained or MQL's own documentation goes more into detail, but just selecting the wrong option, one wrong click in a back test, one thing not understood, you end up wasting all your time. I know one guy who spent YEARS testing with "tick data" selected, kept losing money, couldn't figure it out, until finding out that "tick data" is an option from 2005/2010 (MT4 and MT5 releases) when there was some guess work because computers weren't that powerful. So unless you wanted everything to take like weeks to back test, shortcuts were taken. Today there's no reason to use anything but "tick data based on real ticks".
... who was that guy? Me. I spent years doing the wrong thing, just like you're doing right now. I spent a ridiculous amount of money on computers (over six figures) to install racks of servers at my home under the premise that I could give the computer a bunch of data and it would spit out an optimized working EA. Boy was I wrong. All I ever ended up with was over optimized piles of junk. The computer was doing what I asked, it showed me what would have worked in the past. But what I wanted was something that worked in the future.
You're going about this all wrong. Go watch some videos on how you test a theory scientifically. Don't just slap an EA in and click optimize. Even ATR for SL and TP, you got to do one change at a time. Keep it 1:1 RR at first so you know it's the strategy working or not working; then you can change it up and see if a different RR would be better (keeping in mind the inverse correlation between win rate and RR; if you use 1:1 RR you have 50% odds to win, if you use 1:2 RR you have 33% (2:1) odds to win, etc. Draw a pie chart if it doesn't make sense). Not understanding that is a reason why a lot of people lose a lot of money, they think of trading as a coin flip but that's not true. To complete a trade you take two actions (enter and exit), not one (toss coin).
It's possible to make a lot of money in this industry but remember: Trading is the hardest way to make an easy buck.
- www.mql5.com
There's no template per se, but I use the scientific method. Make sure the EA, and all the testing during development, is about the strategy and factual. Generally speaking, I don't even back test as there's too many ways to screw that up, simplest example is if you use OHLC data. Let's say you use 1H timeframe, open at 1.0 close at 2.0 to keep it simple. The hour starts at 1.5, 15 minutes later you have news. Price spikes to 2.2 and over the next ten minutes it hits 0.8 before settling on 1.5 again at close. How does the back test know which price got hit first? ... it doesn't know. For the back test that trade will continue as if that event didn't happen at all. You're far better off running hundreds of forward tests with demo accounts at that's only one of many ways a back test can get screwed up, bad data is another because how do you even know the computer is using good data? Unless you go in and check for all you know there's tons of gaps. Shoot, price could be entirely wrong and you'd never know unless you go in and check that there's a reasonable match (it won't' match exactly due to the OTC nature of FX).
Your problem isn't using ATR for SL and TP values; it's you didn't do the research and development. You're "thinking of putting aside my current approach". Why? You shouldn't be THINKING about anything. Any decision you make should be backed up with hard numbers to support the decision. There is no room for your opinion when making an EA. Did you try different ATR values side by side? Multiple accounts, same strategy, changing only ONE thing at a time.
And you're using optimization to "see if it can be profitable or not". Nope nope nope. Stop that truck right there. No. You can give me literally ANY strategy and I can show you it makes money. I'll just let the computer search and search until it finds some exact scenario where it just happened to work and be profitable. That's all you're doing. You're wasting your time.
Question for you: Do you know what the difference is between "tick data" and "tick data based on real ticks" when back testing/optimizing? If you don't, you're again wasting your time. There's a simple explanation on Tick Data Explained or MQL's own documentation goes more into detail, but just selecting the wrong option, one wrong click in a back test, one thing not understood, you end up wasting all your time. I know one guy who spent YEARS testing with "tick data" selected, kept losing money, couldn't figure it out, until finding out that "tick data" is an option from 2005/2010 (MT4 and MT5 releases) when there was some guess work because computers weren't that powerful. So unless you wanted everything to take like weeks to back test, shortcuts were taken. Today there's no reason to use anything but "tick data based on real ticks".
... who was that guy? Me. I spent years doing the wrong thing, just like you're doing right now. I spent a ridiculous amount of money on computers (over six figures) to install racks of servers at my home under the premise that I could give the computer a bunch of data and it would spit out an optimized working EA. Boy was I wrong. All I ever ended up with was over optimized piles of junk. The computer was doing what I asked, it showed me what would have worked in the past. But what I wanted was something that worked in the future.
You're going about this all wrong. Go watch some videos on how you test a theory scientifically. Don't just slap an EA in and click optimize. Even ATR for SL and TP, you got to do one change at a time. Keep it 1:1 RR at first so you know it's the strategy working or not working; then you can change it up and see if a different RR would be better (keeping in mind the inverse correlation between win rate and RR; if you use 1:1 RR you have 50% odds to win, if you use 1:2 RR you have 33% (2:1) odds to win, etc. Draw a pie chart if it doesn't make sense). Not understanding that is a reason why a lot of people lose a lot of money, they think of trading as a coin flip but that's not true. To complete a trade you take two actions (enter and exit), not one (toss coin).
It's possible to make a lot of money in this industry but remember: Trading is the hardest way to make an easy buck.
I don't think you are the one who understands here. I only test on real tick based on real ticks because I have a healthy fear of the 1 min ohlc problem you described (I have over 250gb in excel data of just real ticks), and its the reason I don't use most python based backtesting engines is because they can only take 1 min ohlc. In fact, I've brought it up to multiple different creators of different python engines and they tell me that there is no workaround for it and to just ignore it. NOT ONLY THAT but you can actually use 1 min ohlc data in certain scenarios where you control bar opening, thats why if for a certain EA I only open or close trades on bar opens I could then use 1 min ohlc or open prices only and the strategy's results would generally be the same (baring the fact that it wouldn't have a sl or tp because the open and close signals take care of that). Also I literally binge watch the same darwinex optimization playlists until I go to sleep every night and following the advice in their series I have made actually profitable EAs on real tick data from dukascopy that replicate the same performance in forward testing. As far as the OTC nature of forex goes its all basically the same within 1 or 2 pips except during news events which I filter for (and if you're system isn't profitable because of 1 or 2 pips then it probably wasn't going to be profitable anyway) and its also not really a problem for timeframes above 1 hour.
Also don't lecture me on not using a stoploss during strategy creation, the point of not doing this was explained in the video I posted. I just wanted to see what other processes people use for strategy creation and instead I get a reddit blogpost about how you overoptimized. And I've been there and done that already but I never spent a ton of money on servers because once I made that mistake once I went back and figured out I was overoptimizing and now I have a healthy fear of that too. Regarding the ATR sl and tp, not everyone uses that and some people use emergency stoploss only, open and close signals only, partial close/scaling in or out trades. Its just trading with a fixed RR is my "current approach that I'm thinking of putting aside". If you have lost faith in backtesting because "there are too many ways to screw it up" then its because you aren't backtesting right and maybe you should scientifically make a bullet point list and go back a fix what you were doing wrong. (Sry if this post is inflammatory but your style of speech enrages me. However I do appreciate the time you took to at least reply)
I don't think you are the one who understands here. I only test on real tick based on real ticks because I have a healthy fear of the 1 min ohlc problem you described (I have over 250gb in excel data of just real ticks), and its the reason I don't use most python based backtesting engines is because they can only take 1 min ohlc. In fact, I've brought it up to multiple different creators of different python engines and they tell me that there is no workaround for it and to just ignore it. NOT ONLY THAT but you can actually use 1 min ohlc data in certain scenarios where you control bar opening, thats why if for a certain EA I only open or close trades on bar opens I could then use 1 min ohlc or open prices only and the strategy's results would generally be the same (baring the fact that it wouldn't have a sl or tp because the open and close signals take care of that). Also I literally binge watch the same darwinex optimization playlists until I go to sleep every night and following the advice in their series I have made actually profitable EAs on real tick data from dukascopy that replicate the same performance in forward testing. As far as the OTC nature of forex goes its all basically the same within 1 or 2 pips except during news events which I filter for (and if you're system isn't profitable because of 1 or 2 pips then it probably wasn't going to be profitable anyway) and its also not really a problem for timeframes above 1 hour.
Also don't lecture me on not using a stoploss during strategy creation, the point of not doing this was explained in the video I posted. I just wanted to see what other processes people use for strategy creation and instead I get a reddit blogpost about how you overoptimized. And I've been there and done that already but I never spent a ton of money on servers because once I made that mistake once I went back and figured out I was overoptimizing and now I have a healthy fear of that too. Regarding the ATR sl and tp, not everyone uses that and some people use emergency stoploss only, open and close signals only, partial close/scaling in or out trades. Its just trading with a fixed RR is my "current approach that I'm thinking of putting aside". If you have lost faith in backtesting because "there are too many ways to screw it up" then its because you aren't backtesting right and maybe you should scientifically make a bullet point list and go back a fix what you were doing wrong. (Sry if this post is inflammatory but your style of speech enrages me. However I do appreciate the time you took to at least reply)
interesting i wonder why that is
I think its because price data files would be huge and I don't think major crypto exchanges actually store tick by tick data because its not reliable and would probably be a massive fat file for bitcoin and other coins that these people like to trade with the same python/docker based engines. 1 min OHLC is a lot easier to keep but you don't get the granularity that forex provides. They also probably don't keep whatever volume data for dogcrap coin or whatever making it even more unreliable. What's even funnier is these types of people will complain that you don't know what you're talking about and then go and use a 1 cent trailing stop on whatever coin and their 8 day backtest with a swing trading size stoploss proves that the strategy is in fact profitable and not overfit (43 hyperparameters optimized).
I think its because price data files would be huge and I don't think major crypto exchanges actually store tick by tick data because its not reliable and would probably be a massive fat file for bitcoin and other coins that these people like to trade with the same python/docker based engines. 1 min OHLC is a lot easier to keep but you don't get the granularity that forex provides. They also probably don't keep whatever volume data for dogcrap coin or whatever making it even more unreliable. What's even funnier is these types of people will complain that you don't know what you're talking about and then go and use a 1 cent trailing stop on whatever coin and their 8 day backtest with a swing trading size stoploss proves that the strategy is in fact profitable and not overfit (43 hyperparameters optimized).
True , its ~11 gb for ticks from 2000 till today for EURUSD more or less
The on chain data are a headache to collect indeed .
You probably know if the Ducascopy real ticks data is actually the real movement of each tick recorded? I haven't used the strategy tester much, but as much as I have, it seems to me that for example the ITC Market tick data doesn't reflect reality retrospectively, even if the data quality is 99 percent and above... Does it just seem that way to me or is that really the case?
Someone maybe know technically, how does the strategy tester read the `based real tick` data, is it every real recorded tick or is there some algorithm also in the mql5 testers that try to simulate the tick movements or there is simply a unfilled gap between the data stream with the lower quality data ?
In response to the original topic, I would disclose my template like personal approach to make strategies. I create data analysis methods that are necessary for the strategy, then I use these methods to find optimum values. Based on them find a relationship as a delta value. Then calculate the financial value of the delta and use it as the risk capital of the transaction. Now we can simply use the optimized delta itself as a logically significant take profit distance. With a stop loss is more complicated and a bit more calculations, but the idea is the same...I believe that trading is pure mathematics, which is what indicators try to express - and on which you need to build the right risk management. That's why I try to approach it directly...
Anyway , the big advantage of this approach is that by combining data analyzing methods, you can build a number of strategies, just like by building combined indicators and optimizing them... but the only major disadvantage is the complexity of the construction itself. So, only time will tell if this approach justifies itself.
True , its ~11 gb for ticks from 2000 till today for EURUSD more or less
The on chain data are a headache to collect indeed .
I think its because price data files would be huge and I don't think major crypto exchanges actually store tick by tick data because its not reliable and would probably be a massive fat file for bitcoin and other coins that these people like to trade with the same python/docker based engines. 1 min OHLC is a lot easier to keep but you don't get the granularity that forex provides. They also probably don't keep whatever volume data for dogcrap coin or whatever making it even more unreliable. What's even funnier is these types of people will complain that you don't know what you're talking about and then go and use a 1 cent trailing stop on whatever coin and their 8 day backtest with a swing trading size stoploss proves that the strategy is in fact profitable and not overfit (43 hyperparameters optimized).
no no. Collecting such data is not a problem these days even with a decent home PC. The problem comes from data reproduction... think about what will happen if thousands of clients start requesting this data at the same time, that's a serious headache and requires large investments. Therefore, this is a very authentic topic. I really don't have much experience with the mql5 optimizer and strategy tester and tickdata itself. So, You certainly have many more of these experiences. Please answer my previous question, even if You don't know exactly, but based on Your experience you can guess like I did...because it's definitely stupid to look at some youtube or whatever gurus and then blindly believe them....
You probably know if the Ducascopy real ticks data is actually the real movement of each tick recorded? I haven't used the strategy tester much, but as much as I have, it seems to me that for example the ITC Market tick data doesn't reflect reality retrospectively, even if the data quality is 99 percent and above... Does it just seem that way to me or is that really the case?
Someone maybe know technically, how does the strategy tester read the `based real tick` data, is it every real recorded tick or is there some algorithm also in the mql5 testers that try to simulate the tick movements or there is simply a unfilled gap between the data stream with the lower quality data ?
In response to the original topic, I would disclose my template like personal approach to make strategies. I create data analysis methods that are necessary for the strategy, then I use these methods to find optimum values. Based on them find a relationship as a delta value. Then calculate the financial value of the delta and use it as the risk capital of the transaction. Now we can simply use the optimized delta itself as a logically significant take profit distance. With a stop loss is more complicated and a bit more calculations, but the idea is the same...I believe that trading is pure mathematics, which is what indicators try to express - and on which you need to build the right risk management. That's why I try to approach it directly...
Anyway , the big advantage of this approach is that by combining data analyzing methods, you can build a number of strategies, just like by building combined indicators and optimizing them... but the only major disadvantage is the complexity of the construction itself. So, only time will tell if this approach justifies itself.
idk I scrolled back as far as could back in October 2024 and compared dukascopy data to my brokers data on M1 and it was always within 1-2 pips unless there was a calendar importance high event in which case they were wildly different (and I filter for news already so I do not really care). I guess that means the dukascopy data is accurate for at least the last 2 years. I am also thinking about comparing it to darwinex tick data but they only have tick data available until 2017 so its a little more limited for backtesting/optimization.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
For me personally I build strategies based off indicators so I follow something like the darwinex multisymbol template posted on github. I have a bunch of enums for deciding lot size, sl and tp based on ATR, new filter enum, and a bunch of functions I copy and paste over for placing trades that have error checking, new day checking, time filter, etc. I yoinked the custom performance metrics from the darwinex stuff too. I'll post version of it later when I make the code nice and clean but for now I was wondering what sort of templates (for creating strategies or just creating EAs in general) do you guys follow?
Currently I'm finding it hard to create strategies because I base SL and TP on ATR and usually they do not end up profitable, especially on lower timeframes.
I'm thinking of putting aside my current approach and following this method:
1. Abandon ATR sl/tp and instead use min lots in the beginning when designing strategies.
2. Instead of using the sl/tp as exits use a symmetric open/close signal
3. Test on 28 pairs and maybe do a quick optimization just to see if it can be profitable or not. Since I wouldn't be using sl/tp I could use open prices only or 1 min ohlc (because the open and close signals would only react on new bars)
4. Run same test/optimization but instead of min lots use a lot size that scales relative to equity its not the same as risking a flat 1% on each trade like in this video: https://www.youtube.com/watch?v=F_aQESUIdEc&list=PLv-cA-4O3y97HAd9OCvVKSfvQ8kkAGKlf&index=38&t=90s
5. Introduce other indicators or sl/tp techniques like an emergency stop or asset filtering, etc
6. Maybe do walk forward analysis?
I would like some recommendations on what everyone else does for strategy creation from some more experienced people.