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

managed, unmanaged, ATM

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

    managed, unmanaged, ATM

    Hello,

    I´m using in my NT7-script strategies in onExecution

    if(Position.MarketPosition == MarketPosition.Short)inshorttrade=true;
    if(Position.MarketPosition == MarketPosition.Long)inlongtrade=true;
    (Position.MarketPosition == MarketPosition.Flat){inshorttrade=true; inlongtrade=true;}

    to use then the bool in my conditions and I plot this bool with drawtextfixed in the chart to verify.

    Now I have a script from a programmer and I added this snippets but this doesnt work. It always shows "...false" in my chart, even when I´m short or long. Does the "onexecution" statements maybe not work if the script is calling an ATM? If so, what can I use instead to have a simple bool for flat or not to use in my conditions.

    Thank you!
    Tony

    #2
    Hello Tony,

    Thank you for mentioning the script is using Atm Strategy methods.

    No, when placing an order with Atm Strategy methods, the strategy position will not be updated nor with the strategy performance.


    Think of these as orders as being manually placed with an Atm Strategy attached so these can be manually managed.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hello Chelsea,

      thank you for your reply and the link. But another question please: when calling an ATM from a NT-script-strategy is it possible to work with the orders from the ATM like one can do with IOrders, meaning for example to move a stop for 2nd contract when target 1 is filled (and not move it with a fixed number of ticks from ATM settings)

      Can you please give me an example how to do this?

      Thank you
      Tony
      Last edited by tonynt; 06-29-2017, 07:15 AM. Reason: translation error, clearifying

      Comment


        #4
        Hello Tony,

        It would not be possible to save an order to an IOrder using Atm Strategy methods as these do not return an IOrder object.

        You would need to use unsupported methods of looping though the account to get all orders in the account and deciding what to do with them.

        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Hello Chelsea,

          thank you again for your reply. Sorry, if causing misunderstanding because inaccurate translation. I dont need to use it "exactly" like IOrders, I just want to move stop2 to BE with fill of target1. This is not possible when calling an ATM from the script?

          But to avoid this workaround with calling an ATM and instead using setstoploss and setprofittarget in the NT-script please let me ask if setstoploss and setprofittarget from NT-script-strategy do work exactly same (OCO and whatever else is important) on NT-Brokerage-Servers and Exchange as if the orders would have come from an ATM. Or do I have to add something in the NT7-script so that setstoploss and setprofittarget work exactly same as from an ATM?

          Thank you
          Tony

          Comment


            #6
            Hello Tony,

            Below is a link to the help guide on Atm Strategy methods.


            If you want to change the position of a stop or target use AtmStrategyChangeStopTarget() and supply the atm strategy id and name of the order as it appears on the Orders tab of the Control Center ("Stop1", "Stop2", "Stop3", "Target1", "Target2", "Target3").
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Hello Chelsea,

              thank you for your reply. There was a sample about calling ATM from script do you have the link or name?

              My last question - again from the post before - please, when discussing this topic to know about this:

              "But to avoid this workaround with calling an ATM and instead using setstoploss and setprofittarget in the NT-script please let me ask if setstoploss and setprofittarget from NT-script-strategy do work exactly same (OCO and whatever else is important) on NT-Brokerage-Servers and Exchange as if the orders would have come from an ATM. Or do I have to add something in the NT7-script so that setstoploss and setprofittarget work exactly same as from an ATM?"

              Thank you
              Tony

              Comment


                #8
                Hello Tony,

                Included with NinjaTrader is the SampleAtmStrategy.

                Tools -> Edit NinjaScript -> Strategy -> SampleAtmStrategy.

                This demonstrates using AtmStrategyChangeStopTarget().


                SetStopLoss() and SetProfitTarget() use OCO and work very similar to the initial placement of a stop loss and profit target in an Atm Strategy.
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  Hello,

                  I have another question now in this concern please. When calling an ATM from NT7-script does the chase if touched from ATM work?

                  Thank you
                  Tony

                  Comment


                    #10
                    Hello Tony,

                    Yes, the Chase if touched and Profit chase will work when calling AtmStrategyCreate with a template that has this enabled.
                    (The Chase Limit must be set to something other than 0)
                    Chelsea B.NinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Perr0Grande, Today, 08:16 PM
                    0 responses
                    2 views
                    0 likes
                    Last Post Perr0Grande  
                    Started by elderan, Today, 08:03 PM
                    0 responses
                    3 views
                    0 likes
                    Last Post elderan
                    by elderan
                     
                    Started by algospoke, Today, 06:40 PM
                    0 responses
                    10 views
                    0 likes
                    Last Post algospoke  
                    Started by maybeimnotrader, Today, 05:46 PM
                    0 responses
                    9 views
                    0 likes
                    Last Post maybeimnotrader  
                    Started by quantismo, Today, 05:13 PM
                    0 responses
                    7 views
                    0 likes
                    Last Post quantismo  
                    Working...
                    X