Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Programmatically set SL and TP once entered in a trade

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

    Programmatically set SL and TP once entered in a trade

    Hello,
    I am developing a drawing tool which allows me to draw on the chart a structure which allows me to asses where to enter , which stop loss and which take profit to put.
    I managed to implement a clickable area on my tool which will insert the entry order, which works (at least in sim01), but I have the usual problem of not being able to put a stop loss and a take profit automatically. What I have to do is select programmatically a predefined ATM strategy with say 10 points stop loss and take profit, and use that - I then have to monitor the chart and when my entry gets filled I have to quickly move manually the SL and TP to the right places, which is terrible as many times I will not make it in time during volatile moves.
    I would like to be able to programmatically create an atm entry with my precise take profit and stop losses. Or I would like to be able to be notified when the entry gets filled and the programmatically create 2 orders linked by an OCO identifier , one for stop loss and one for take profit, but it seems to be impossible from a drawing tool.
    Is there any way I can automate my stop loss and take profit for the inserted entry? I need speed for NQ market!

    #2
    Hello FDN73,

    To do that you would have to monitor for the orders using the accounts OrderUpdate event and then gather the Order variables. Once you do that you can use the accounts Change method to change the orders to a different price.


    Comment


      #3
      Yep, it's working: I was looking for the wrong string for the account (Sim01 instead of Sim101, Doh!)

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      579 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      334 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      101 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      554 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      551 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X