Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How do I add to my position

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How do I add to my position

    Hello All,

    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...

    #2
    Change your entries per direction to 2.

    This will allow 2 tagged entries in a given direction.

    You are probably set to 1, so any other entry is ignored, whether or not a new tag is given.



    Originally posted by bradleg View Post
    Hello All,

    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

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    68 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    37 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    62 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    62 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    53 views
    0 likes
    Last Post CarlTrading  
    Working...
    X