las vegas
Experience: Intermediate
Platform: Sierra Chart
Broker: Velocity/IB
Trading: 6E
Posts: 1,145 since Feb 2010
Thanks Given: 304
Thanks Received: 844
|
Need help with code logic (in either c# or c++, doesn't matter).
I want to enter the first position at 1 unit based upon certain conditions.
Then add a second unit based upon certain conditions. The second unit has target and reversal conditions that are separate from the first unit.
If the second unit meets its target conditions, then it closes.
If the second unit meets its reversal conditions, then it reverses and creates a second position. The second position is managed with the same rules, but independently from the first position and the second position can also add a second unit. Continuing with the logic, the second unit on the second position can create a third position if the reversal conditions are met, etc. In other words, each position is capable of spawning a new position that is managed independently from the others.
Obviously, the first position can be long and the second position can be short at the same time, so that the actual net position is flat, but the virtual positions will persist. I can create the logic to net the virtual entries/exits of all positions to arrive at a net order to buy or sell x number of units.
I just can't figure out how to spawn a new position with the total number of positions limited to a desired amount. I keeping thinking that I'm over thinking it, but under thinking it isn't working either.
Thanks for any help.
|