Firstly, I am an experienced C# developer, so I am not a afraid to write software.
For the last, week I have been struggling with understanding how to add contracts to my position. Below is a simple example of how I believe it should work. However, I think I am making an error, so I need some one to clarify.
How do I take a long position with one contract, then later add to that position, and when I want to exit, exit all the contracts simultaneously.
Proposed code:
if ((Position.MarketPosition == MarketPosition.Flat) && (SMA(20) > SMA (30))
EnterLong ("Long Entry #1")
if ((Position.MarketPosition == MarketPosition.Long) && (SMA(20) > (SMA (30) * 1.1)
EnterLong ("Long Entry #2")
if ((Position.MarketPosition == MarketPosition.Long) && (SMA(20) < (SMA (30)))
ExitLong ("Exit All Longs?")
Please advise...

Comment