Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to get stop loss & profit target movable on chart when strategy places the orders

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

    How to get stop loss & profit target movable on chart when strategy places the orders

    Hi,


    I am trying to find out how to get it so that once my strategy executes an order, i want to be able to adjust the stop and profit target on my chart. Right now, my code when it places and the trail logic is so whack that if i move it, the order moves back to the position it was previously and moves based on the logic hardcoded. It won't adjust to me moving it on the chart.


    This i what i want to code:

    INPUT PARAMETERS BY USERS:
    Profit Target: [by points]
    Stop Loss: [by points]
    Trail By: [by points]
    Break Even: [by dollar amount]



    CODE: (example condition when 50MA moves above 200MA go long and if it goes below go short)



    if {condition is met}
    {
    go long
    else
    {condition2 is met}
    go short
    }



    Whenever there is an order that executes, the profit target is set and stop loss is set.


    Trail Stop loss by parameter [Trail by]


    Whenever the position is in profit by $50, move stop loss to break even.


    On chart, if we move the stop loss with mouse, it should move to the price we move it to and continue trail from there by [trail by] parameter.

    On chart, if we move the profit target, it should move and stay in that price.





    #2
    Hello priceisking,

    If you want to do trailing actions you would not be able to manually move the order, the strategy would be in control in that use case. Manual movements would not be observed by the strategy so the order would snap back to its original price the strategy knows about. For stationary orders you can manually move those by using live until cancelled orders in a manually coded strategy. There is a sample that shows how to do that in the following link.

    Hello, I have a strategy that places stop and target orders once an order is executed. However, when i see the orders on the chart trader and I want to move

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    88 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    134 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
    118 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    67 views
    0 likes
    Last Post PaulMohn  
    Working...
    X