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 Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    647 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    368 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    108 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    571 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    573 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X