Hello fellow geeks,

I'm fresh from boot-camp (noob alert) and didn't find anything helpful in the community.

I'm writing a strategy that I've successfully implemented in MT5 but here I got to a dead end…I've set my bot to buy some stocks at the end of every month. The goal here is to hold each stock for a year and then liquidate after 245 trading days (from the day of purchase) if the trade is a loss, or wait to hit 265 and then sell, if the trade is in profit (tax-optimized).

All the tutorials and docs I've been through talk in detail about how to liquidate on OnSecuritiesChanged() but nothing really on how to get the data of any opened position.

I know you guys have a ton more experience than me… any suggestions?