The following suggestions can be made:
-
Activate a time-based filter: Reduce trades during low-liquidity periods.
-
Add a general trend filter (e.g., moving average or higher time frame analysis).
-
Combine strategies using a voting system: Only open a trade if, for example, 3 out of 5 indicators agree.
-
Flexible risk management: Instead of a fixed stop loss, use a percentage of the ATR or the average candle size.
-
Dynamic exit strategy: Add features like a trailing stop or exit on opposite signals.
You need to look at the structure of your program. You open an indicator (assign a handle to it), every time you call the signal routine and you never release a handle! Assigning handles should happen at the initialization stage and releasing of handles should happen in the DeInit routine.
I would recommend you read up on using an Object Oriented method in building this expert. It would make it much easier to avoid these sort of issues and would massively reduce the amount of code you had to write.
It was a good effort all the same and it works reasonably well, so well done.
I modified your code (file attached), declaring all the handles as global (at the top of the file), assigning (and checking) all the handles in the OnInit() function and releasing all the handles in OnDeInit(). I commented out all the handle assignments in the GetSignals functions. The resulting EA runs substantial faster and is likely to be more robust.
You need to look at the structure of your program. You open an indicator (assign a handle to it), every time you call the signal routine and you never release a handle! Assigning handles should happen at the initialization stage and releasing of handles should happen in the DeInit routine.
I would recommend you read up on using an Object Oriented method in building this expert. It would make it much easier to avoid these sort of issues and would massively reduce the amount of code you had to write.
It was a good effort all the same and it works reasonably well, so well done.
I modified your code (file attached), declaring all the handles as global (at the top of the file), assigning (and checking) all the handles in the OnInit() function and releasing all the handles in OnDeInit(). I commented out all the handle assignments in the GetSignals functions. The resulting EA runs substantial faster and is likely to be more robust.
You are right.
I made all the necessary changes, although there is no difference in the speed of code execution. But now things are more correct.
You are right.
I made all the necessary changes, although there is no difference in the speed of code execution. But now things are more correct.
To make a BIG difference to the speed, I made the following change at the start of the OnTick() function:
void OnTick() { //--------------------------------------------------------------------- //--- Only run on completion of a bar static datetime bartime=0; datetime tm = iTime(NULL,TimeFrame,0); if(tm==bartime) return; bartime = tm;
Hi, I'm a beginner, I ran the code and it seems to have really good results. But I got stuck in choosing the best indicators. Thanks in advance for your answerih
Hi,
To find the right settings, you need to take the time to do a lot of testing.
This process is always time-consuming, but so necessary.
Best regards.
I have made some optimizations to your code, Nikolaos Pantzos, and I am attaching it for your review. It compiles successfully, but only you can determine if it aligns with your original version. Additionally, I was curious if you traded futures on LIFFE or EUREX during the 80s and 90s, or if I might be confusing you with someone else.
Very nice!
I don't know about the trader you're talking about. It wasn't me, anyway.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Seven strategies in One expert:
Name of expert is 'MultiStrategyEA'
Author: Nikolaos Pantzos