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 Taddypole, 04-26-2024, 02:47 PM
    1 response
    10 views
    0 likes
    Last Post NinjaTrader_Eduardo  
    Started by futtrader, 04-21-2024, 01:50 AM
    6 responses
    58 views
    0 likes
    Last Post futtrader  
    Started by sgordet, Today, 11:48 AM
    0 responses
    4 views
    0 likes
    Last Post sgordet
    by sgordet
     
    Started by Trader146, Today, 11:41 AM
    0 responses
    5 views
    0 likes
    Last Post Trader146  
    Started by jpapa, 04-23-2024, 07:22 AM
    2 responses
    19 views
    0 likes
    Last Post rene69851  
    Working...
    X