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 NullPointStrategies, Today, 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