Hello again.
I'm building my strategy and it's becoming big, and I need a better way to manage how the objects interact with each other. I'm new to OOP.
Can I generate signals—events like—instead of manually checking for conditions on every signal object from the trading class? Then, the trade class would have a mechanism to catch the events and perform actions.
Two reasons I want a better approach:
1. I'm checking the signal on new bar on the first tick and I miss the switch signal around 40% of the time. I think the dot is not created yet on the first tick when I miss it. If I use events I can run ontick and reduce missed signals. using flags seems cumbersome to me.
2. I want to use a vast number of signal gen objects, and I want the trade class to only watch for the events without manually checking conditions in each.
I'm not sure if it is something I could do. Maybe I don't have the right words to search through to get ideas on this. I will appreciate pointers to the right direction. Thanks
I achieved this by using https://www.mql5.com/en/docs/eventfunctions/eventchartcustom
And then using OnChartEvent on my trading logic to watch for and catch the custom event ID.
- www.mql5.com
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello again.
I'm building my strategy and it's becoming big, and I need a better way to manage how the objects interact with each other. I'm new to OOP.
Can I generate signals—events like—instead of manually checking for conditions on every signal object from the trading class? Then, the trade class would have a mechanism to catch the events and perform actions.
Two reasons I want a better approach:
1. I'm checking the signal on new bar on the first tick and I miss the switch signal around 40% of the time. I think the dot is not created yet on the first tick when I miss it. If I use events I can run ontick and reduce missed signals. using flags seems cumbersome to me.
2. I want to use a vast number of signal gen objects, and I want the trade class to only watch for the events without manually checking conditions in each.
I'm not sure if it is something I could do. Maybe I don't have the right words to search through to get ideas on this. I will appreciate pointers to the right direction. Thanks