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

Functionality inquiry

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

    Functionality inquiry

    I would like to perform the following functions, possibly as part of an automated strategy. Is Ninjatrader able to do this?

    1) Order submission based on a trailstop by percentage.
    -Example: A 1% trailstop on a buy order would cause a buy order to be submitted when the price increases 1% at any time that the order is active. After the order is active, the price may fall 10%, but the buy order will execute only once the price rises 1% at any time during that downtrend.

    2) Order submission and cancelation at a specific time-of-day.
    -Example: A buy order containing two conditions for time-of-day: one condition for time of order submission and one condition for time of order cancelation. If the order becomes active at 10am, and after that time other conditions are not met for the order to execute (such as a 1% trailstop), then the order will cancel at 10:30am.

    3) OCO order containing three subordinate orders that become active after the initial trigger order executes. When one subordinate order executes, it cancels the others. Each subordinate order should also be able to be triggered by a trailstop based on percentage. I want to use this function in conjunction with functions (1) and (2).

    I have not found any trading platform that can perform these functions besides Think or Swim, which I prefer not to use. Can you help me?

    #2
    Hello yab00,

    1) Order submission based on a trailstop by percentage.
    -Example: A 1% trailstop on a buy order would cause a buy order to be submitted when the price increases 1% at any time that the order is active. After the order is active, the price may fall 10%, but the buy order will execute only once the price rises 1% at any time during that downtrend.
    You can perform actions like this with orders in NinjaScript, you would ultimately need to come up with the logic to do that but you can control orders from code. NinjaScript is C# language and you would have access to the price data and can have the script calculate at various rates based on the bar series used.

    One way to start here would be to look at a very simple example of moving an order based on a condition, you can find an example of doing a break even in the following link. https://ninjatrader.com/support/help...and_onexec.htm

    2) Order submission and cancelation at a specific time-of-day.
    -Example: A buy order containing two conditions for time-of-day: one condition for time of order submission and one condition for time of order cancelation. If the order becomes active at 10am, and after that time other conditions are not met for the order to execute (such as a 1% trailstop), then the order will cancel at 10:30am.
    This is also possible, you can work with time in NinjaScript. The OnBarUpdate event is called based on the bar series being used, for example if you used 1 minute bars then OnBarUpdate can be called every 1 minute to execute your logic. The Time series can be referenced to check what time the current bar is, once the 10:30 bar happens you could use that to do other logic.
    The strategy builder webinar is a good place to start as that shows how to form basic price conditions and also working with times. This is the public youtube link: https://youtu.be/VxU4FR6GWNA


    3) OCO order containing three subordinate orders that become active after the initial trigger order executes. When one subordinate order executes, it cancels the others. Each subordinate order should also be able to be triggered by a trailstop based on percentage. I want to use this function in conjunction with functions (1) and (2).
    You can create more complex sets of order using the unmanaged approach where you can specify OCO on the orders you choose. The platform will automatically apply OCO to target orders that are submitted with SetStopLoss/SetProfitTarget.



    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by guillembm, Yesterday, 11:25 AM
    2 responses
    9 views
    0 likes
    Last Post guillembm  
    Started by junkone, 04-21-2024, 07:17 AM
    9 responses
    68 views
    0 likes
    Last Post jeronymite  
    Started by trilliantrader, 04-18-2024, 08:16 AM
    4 responses
    20 views
    0 likes
    Last Post trilliantrader  
    Started by mgco4you, Yesterday, 09:46 PM
    1 response
    11 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Started by wzgy0920, Yesterday, 09:53 PM
    0 responses
    10 views
    0 likes
    Last Post wzgy0920  
    Working...
    X