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 NullPointStrategies, Yesterday, 05:17 AM
    0 responses
    56 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    132 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    73 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    45 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    49 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X