Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Adjusting stop, when allowing MULTIPLE entries per direction?

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

    Adjusting stop, when allowing MULTIPLE entries per direction?

    Howdy,

    Just for example, I am assigning a stop and profit target upon entering a trade within the onBarUpdate() method like so:
    Code:
    EnterLong(Convert.ToInt32(lotSize), "BuySignal");
    SetStopLoss(@"BuySignal", CalculationMode.Pips, myStop, false);
    SetProfitTarget(@"BuySignal", CalculationMode.Pips, myTgt);
    So, adjusting the stop is easy if only allowing one entry. I could simply check if in a long position like the example HERE, and adjust it by comparing the average price.

    However, if allowing multiple entries, there is no way to know which signal needs to be adjusted.

    So... I was thinking of doing this, I would assign each trade its own unique signal name... storing this name into a list, along with the entry price, and a flag if the trade is still active. And on each bar, update this list to see if the trade is open, or if a price has been achieved to update the stop(if still active).

    The above will work, but it is a bit of work.

    So I am wondering if there is a better way of doing this, or if there is a trade collection that will have these metrics for active trades, like something using GetTrade(), or something else, so I am not reinventing the wheel?

    Thanks!

    #2
    Hi forrestang, thanks for writing in.

    You will need to use unique signal names to target each entry separately with different stops and targets. C# makes it fairly easy to manage data with data structures like the Dictionary, or one could make a custom Class or Struct that holds the properties of each order and make a List<Class> with the List<T> data structure. Specific data about each execution or order can be captured from OnExecutionUpdate and OnOrderUpdate.

    Best regards,
    -ChrisL

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    93 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    138 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    68 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    123 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    73 views
    0 likes
    Last Post PaulMohn  
    Working...
    X