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

Replicating ATM in a Strategy

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

    Replicating ATM in a Strategy

    Since we can not back test a strategy using an ATM, I was going to try to replicate a simple ATM for back testing purposes.

    Enter 3 Contracts
    Initial Stop 3 Contracts at 4 Ticks
    Move 3 contracts to Breakeven after 4 ticks of profit
    Exit 1 Contract at 6 Ticks Profit
    Exit 1 Contract at 8 Ticks Profit
    Exit 1 Contract at 10 Ticks Profit.

    So far I have not been successful. Is there a sample script showing the "Best Practice" for doing this that I have not found?

    #2
    Hello TAJTrades,

    Thank you for the post.

    I am unaware of a specific sample to simulate "ATM" logic historically but we do have some various samples which apply to what you are asking.

    The first would be managing targets based on order events, you can find a sample here: https://ninjatrader.com/support/help...and_onexec.htm

    This sample is useful for a few reasons, mainly this demonstrates storing order objects and accessing their values. In addition this shows how to manage target orders based on the events your entries cause such as filling.

    For more advanced target control the following sample could be used. This shows how to cause a trailing action and how to set target prices / compare them with the Close price: https://ninjatrader.com/support/foru...ploss-behavior

    Breakeven logic and simple price movement logic are similar to the trailing logic in the above sample. In those cases rather than continually updating the order after the target price is met, you would only do this once to "breakeven" the order. Similar to the sample you would observe the current Close price and compare that against a preset breakeven or target movement price. The target price could be configured when the entry order fills from OnExecutionUpdate. This is also the point in which all of the exit prices could be set based on the entries average fill price.


    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      I have all those samples and they were helpful.
      But they all deal with just 1 entry and 1 contract. Can you provide some guidance when dealing with one entry and multiple exits? Do I need 3 different entry orders for 1 contract each with unique string signalNames and tie the SL and TP to the unique string signalName. If I use 1 EnterLong(3, MyEntry) then hows does NT handle splitting that into 3 exits Conditions? I am lost.
      Last edited by TAJTrades; 10-08-2018, 03:29 PM.

      Comment


        #4
        Hello TAJTrades,

        Thank you for the reply.

        If you will be using the managed approach, generally you would use individual entries and unique signal names. This gives you the ability to specify the quantity you wanted which would also allow you to associate individual targets with those entries. If you instead wanted to enter once and scale out of the position with multiple targets, the unmanaged approach is generally a better choice for that.

        We have a managed approach sample of scaling out in the help guide here: https://ninjatrader.com/support/help...aleOut_NT8.zip

        I am unaware of a sample using the unmanaged approach for scaling specifically. There is an unmanaged sample demonstrating an OCO for targets which is helpful if you need the groundwork for creating an unmanaged strategy. After submitting and having an entry fill, you would use logic similar to how this sample sets up the targets to control your multiple exits.



        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Skifree, Today, 03:41 AM
        1 response
        4 views
        0 likes
        Last Post Skifree
        by Skifree
         
        Started by usazencort, Today, 01:16 AM
        0 responses
        1 view
        0 likes
        Last Post usazencort  
        Started by kaywai, 09-01-2023, 08:44 PM
        5 responses
        603 views
        0 likes
        Last Post NinjaTrader_Jason  
        Started by xiinteractive, 04-09-2024, 08:08 AM
        6 responses
        23 views
        0 likes
        Last Post xiinteractive  
        Started by Pattontje, Yesterday, 02:10 PM
        2 responses
        23 views
        0 likes
        Last Post Pattontje  
        Working...
        X