Summing Strategies

 

Hi there,

i am looking to combine multiple strategies in one EA and have it trade the net position.

for example

the first pass requires a total position of 9 contracts: the EA buys 9

the next pass requires a total position of 10 contracts: the EA buys 1 (9+1=10)

the next pass requires a total position of 5 contracts: the EA closes 5 (10-5=5)

the next pass requires a total position of -5 contracts: the EA closes 5 and shorts 5 (5-5=0, 0-5=-5)

etc. etc.

(obviously the totals are hypothetical, trades are executed at market)

any help with the code to execute aggregated trades in this way would be much appreciated.

Thanks in advance,

Nick
Reason: