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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    47 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    23 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    33 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    50 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    42 views
    0 likes
    Last Post CarlTrading  
    Working...
    X