Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Managing multiple trades (without string names?)

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

    Managing multiple trades (without string names?)

    Dear people,
    after searching around for hours I didn't come to a solution to my problems. So perhaps you can either indicate a solution if it exists or point to the correct links.

    I want to code a system with the following features:

    1. Given a particular entry signal, entry orders at market should be placed. The signal can ask for recurrent entries in the same direction (so I am not "hedging", no conflict of long and shorts), number of entries is unknown. So I cannot establish in advance a "name" for the different trades in the same direction.

    2. Every trade must last a specified number of bars after entry. The BarsSinceEntry method has as an argument a string. And of course it is useless without arguments, because I don't need the information about the last entered trade.

    3. Given (another kind of) opposite signal, all trades must be unconditionally closed (i.e. either they are stopped by the time limit, or reach take profit or stop loss, or are closed by the "opposite" signal).

    Now, being a self-though bad programmer I would ask whether there is an elegant C# solution to this problem (which would likely be to assign a non-changing, unlimited, numerical identifier to each order), or if, with a very dirty "C-like" approach, the only solution would be to manipulate strings, casting an integer to string and eventually appending it to a label like "TradeN_" when entering a trade and then make the reverse process when it is time to exiting trades (like making a for cycle re-casting the index to string for identifying the single orders)

    Would a strategy with the specification above be possible also with managed order handling or just with the unmanaged? [Note: in future version of the system stop loss and take profit need also to be changed on a bar-basis, so this would imply again going on with the dirty number-to-string procedure for each position...]

    Thanks in advance for all the possible help.
    Sorry: I would like to understand the thing by myself, so do not simply suggest to hire a coder (as far as possible!).

    Bye

    F

Latest Posts

Collapse

Topics Statistics Last Post
Started by sjsj2732, Yesterday, 04:31 AM
0 responses
31 views
0 likes
Last Post sjsj2732  
Started by NullPointStrategies, 03-13-2026, 05:17 AM
0 responses
286 views
0 likes
Last Post NullPointStrategies  
Started by argusthome, 03-08-2026, 10:06 AM
0 responses
283 views
0 likes
Last Post argusthome  
Started by NabilKhattabi, 03-06-2026, 11:18 AM
0 responses
133 views
1 like
Last Post NabilKhattabi  
Started by Deep42, 03-06-2026, 12:28 AM
0 responses
91 views
0 likes
Last Post Deep42
by Deep42
 
Working...
X