Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Multiple Targets

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

    Multiple Targets

    Hello. I am trying to set multiple targets in my strategy. I am setting unique signal names by adding a counter to string that I have set depending on the type of entry I'm using. It works fine in playback, which deceptively fills me rather quickly. When trying this in the live markets, it doesn't quite work as I currently have it structured.
    My code is currently in OnBarUpdate, and will split my total lot size between the two orders. It send the request for the first which is a market order using a unique name and lot size, then starts requesting the second one. However, in live markets, it seems that it sends the request of the first and it manages to continue with the code to start the second request before it fills the first. That causes issues as it is trying for multiple entry orders at the same time. So it changes my entry order for the first one and overwrites it with the second.

    I know it has been suggested from support that in order to have multiple targets one needs to have separate entries, so how should I go about structuring this?

    #2
    Hello rockmanx00,

    It sounds like you need a seperate condition that happens at a later time based on your description. If you need to wait for the first order to fill in order to submit the second order correctly you would have to come up with a condition that happens at a later time on a different OnBarUpdate event. Orders can be submitted at the same time also so you could submit a first enty and then a second with seperate names at the same time. Targets are always submitted upon the associated entry filling so you can call all of those methods at once like the following:

    SetStopLoss("longEntry1", CalculationMode.Ticks, 10, false)
    SetStopLoss("longEntry2", CalculationMode.Ticks, 10, false)
    EnterLong("longEntry1");
    EnterLong("longEntry2");

    Comment


      #3
      Thank you Jesse for your quick reply. I don't mind being able to submit them at the same time, which means the issues lies in how I set the "entryOrder" in OnOrderUpdate. I currently have it so that if the entry name matches one of the types I use "buyPullback" "buyMarket" etc., it sets that as the "entryOrder" to be used with OnExecutionUpdate. When both are being processed at the same time, it replaces entryOrder with the second. How would you go about handling that? I was thinking of having multiple entryOrders but that would complicate things a bit more than I think is necessary. I'm using an unmanaged approach and setting the stop and target orders as I get filled for accurate risk to reward.
      Last edited by rockmanx00; 02-18-2025, 12:59 PM.

      Comment


        #4
        Hello rockmanx00,

        You would need to use separate variables in OnOrderUpdate. When you submit an order an its status changes that calls OnOrderUpdate and you can see which order it was by looking at the orders name. Based on the orders name you could set it to whichever variable that order belongs to.

        Comment


          #5
          Got it. Thank you. I'll give that a shot. Appreciate you.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by NullPointStrategies, Yesterday, 05:17 AM
          0 responses
          53 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          130 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          70 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          44 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