Quote from TraderMojo:
Hopefully some of these discussions will yield an idea or two that you can incorporate into JSystemTrader as the thread goes along.
I hope so, too. The JSystemTrader design is very similar to yours (although JSystemTrader is more narrow in scope), so we are pretty much on the same page. However, there may be some confusion because of the class naming, so it would be good to define each class responsibilities explicitly.
It looks to me that your SignalGenerator is acting as a) a signal generator, b) a trading strategy, c) a trader, and d) a money manager. Given your apparent emphasis on pure OO design, it seems that SignalGenerator is too heavy with its responsibilities.
From the name of the class, I initially thought that all it does is to generate trading signals, such as "buy" and "sell", based on some technical indicator. So, what I suggested in my previous post is that that functionality would fall quite naturally to that class scope, but anything beyond should be defined elsewhere.
I am also a little confused by the PositionManager, because I originally thought that its function is, well, to manage positions. That is, I attributed the "money management" functionality to it. For example, suppose a buy signal is generated, and PositionManager calculates the risk/reward and decides to buy 1 contract. Later on, another "buy" signal is generated (perhaps from a different indicator), and PositionManager decided to add to an existing position. However, as you clarified, the PositionManager responsibilities are just to track the P&L. That's fine, too, but what class performs money management then?
Now, what I think of a class named Trader is a class that doesn't know anything about indicators, signals, positions, and P&L. All it knows is how to place orders. It's dumb in its ignorance, so to speak, but that's precisely the intent. In your design, perhaps it's a function of OrderManager?