I am trying to modularize my EA with Classes because it's getting bloated with many lines of codes. I want to put all my exit strategies into a Class (Class ExitStrategies), which will calculate and store the exit prices every time a new bar is formed and detect if the prices are hit. Then i will make 2 instances: 1 for Short orders and 1 for Long orders.
Then I realised I have so many settings that i need to pass into the Class. And since i am making 2 instances, i have to pass the exact same settings to 2 instances. Can I create a new Class just to store the settings (ExitStrategySettings)? But how do i pass that initialized object to the 2 instances so that they can retrieve?
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Hi,
I am trying to modularize my EA with Classes because it's getting bloated with many lines of codes. I want to put all my exit strategies into a Class (Class ExitStrategies), which will calculate and store the exit prices every time a new bar is formed and detect if the prices are hit. Then i will make 2 instances: 1 for Short orders and 1 for Long orders.
Then I realised I have so many settings that i need to pass into the Class. And since i am making 2 instances, i have to pass the exact same settings to 2 instances. Can I create a new Class just to store the settings (ExitStrategySettings)? But how do i pass that initialized object to the 2 instances so that they can retrieve?
Thanks for any help.