Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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
    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by ageeholdings, Today, 07:43 AM
    0 responses
    3 views
    0 likes
    Last Post ageeholdings  
    Started by pibrew, Today, 06:37 AM
    0 responses
    4 views
    0 likes
    Last Post pibrew
    by pibrew
     
    Started by rbeckmann05, Yesterday, 06:48 PM
    1 response
    14 views
    0 likes
    Last Post bltdavid  
    Started by llanqui, Today, 03:53 AM
    0 responses
    6 views
    0 likes
    Last Post llanqui
    by llanqui
     
    Started by burtoninlondon, Today, 12:38 AM
    0 responses
    12 views
    0 likes
    Last Post burtoninlondon  
    Working...
    X