Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Tradestation Export to ATM

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

    Tradestation Export to ATM

    I have been searching the forum for an answer to this question....it seems as if all the responses have been very vague and simply show a link to the online manual....This command does not work properly....it keeps sending orders...the syntax is not correct....the NT sample strategy also does not work properly....it sends no orders....can asomeoneplease help me get this functionality working properly>

    Success = NTCommand("PLACE","Sim101","BUY",1,"LIMIT",AVG.IN, 0,"GTC","","6E_ordID","ECRatchet","");



    I added this to my EL code......it still does not work properly......
    ///....Send orders to Ninja Trader.............................
    //IOG MUST BE ENABLED IN ORDER TO USE NTDIRECT.DLL
    [IntrabarOrderGeneration = TRUE]
    //THIS BEGINS THE SECTION THAT ENABLES NT PLATFOR TO GET MARKET DATA FROM TS
    DefineDLLFunc: "NtDirect.dll", int, "Ask", lpstr, double, int;
    DefineDLLFunc: "NtDirect.dll", int, "Bid", lpstr, double, int;
    DefineDLLFunc: "NtDirect.dll", int, "Last", lpstr, double, int;
    DefineDLLFunc: "NtDirect.dll", int, "Set", lpstr, int;

    vars: intrabarpersist lastCurrentBar(-1),
    intrabarpersist lastVolume(0),
    vol(0);

    if LastBarOnChart then begin
    if lastCurrentBar <> CurrentBar then begin
    vol = Volume;
    lastVolume = 0;
    end else begin
    vol = Volume - lastVolume;
    end;
    lastCurrentBar = CurrentBar;
    lastVolume = lastVolume + vol;

    Ask(GetSymbolName, CurrentAsk, AskSize);
    Bid(GetSymbolName, CurrentBid, BidSize);
    Last(GetSymbolName, Close, vol);
    end;

    Vars: success(0);
    { place an order, if there is no position yet }
    { Copyright (c) 2005, NinjaTrader LLC [email protected] }

    #2
    Hi 9Baller,

    Allow me to dive in a little deeper for you...
    Can you help me to test this by answering the following:
    1. Please clarify "This command does not work properly....it keeps sending orders...the syntax is not correct"

    2. "the NT sample strategy also does not work properly....it sends no orders" Which sample? Can you give me the all steps you take to reproduce this, so that I can test it on my end?
    TimNinjaTrader Customer Service

    Comment


      #3
      The below code (NT strategy sample) does not send orders from TS to NT....the connection is online...ATI is enabled...and boxes are checked under strategies in TS to generate automated orders.... also the NT command function is not correctly initiating my ATM strategy when I use it to send my custom signals from TS to NT ....it sends multiple orders at the limit price....




      Copyright (c) 2005, NinjaTrader LLC [email protected] }
      inputs: FastLength(9), SlowLength(18) ;
      variables: FastAvg(0), SlowAvg(0), Success(0);

      if LastBarOnChart and NTConnected(1) then begin
      if NTMarketPosition("") = 0 then begin
      { place an order, if there is no position yet }
      if AverageFC(Close, FastLength) > AverageFC(Close, SlowLength) then begin
      Success = NTBuyMarket("MyOrderId", 1); { buy 1 unit at market, assign order id (optionally) }
      end else begin
      Success = NTSellMarket("MyOrderId", 1); { sell 1 unit at market, assign order id (optionally) }
      end;
      end else begin
      { print some information on the current position and order }
      Print("Position size: " + NumToStr(NTMarketPosition(""), 0));
      Print("AvgEntryPrice: " + NumToStr(NTAvgEntryPrice(""), 2));
      Print("OrderStatus: " + NTOrderStatus("MyOrderId"));
      Print("Filled #: " + NumToStr(NTFilled("MyOrderId"), 0));
      Print("AvgFillPrice: " + NumToStr(NTAvgFillPrice("MyOrderId"), 2));
      Print("BuyingPower: " + NumToStr(NTBuyingPower(""), 2));
      Print("CashValue: " + NumToStr(NTCashValue(""), 2));
      Print("RealizedPnL: " + NumToStr(NTRealizedPnL(""), 2));
      end;
      end;

      Comment


        #4
        Do you get any errors shown with our NT Sample?

        For which symbol are you trying to send orders?

        Is that receiving correctly data in NT?

        For your custom script - you would need to check your conditions - it will send a PLACE command whenever that is evaluates to 'true'. See for example the logic we have in ours to ensure it would only send an order on the last bar and if there's no market position.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Do you get any errors shown with our NT Sample?
          No it just does not send any orders....
          For which symbol are you trying to send orders?
          ecz10 on TS which is 6e12-10 on NT
          Is that receiving correctly data in NT?
          yes dome is moving
          For your custom script - you would need to check your conditions - it will send a PLACE command whenever that is evaluates to 'true'. See for example the logic we have in ours to ensure it would only send an order on the last bar and if there's no market position.
          guide me to the example logic...I am having trouble finding correct examples....I substituted your nt command function into the NT sample code ( replaced the buy @market orders)....that code fires off hundreds of orders...because it's a LIMIT ORDER THAT IS NOT YET FILLED IT KEEPS FIRING ORDERS ....THERE IS NO POSITION YET....(it has the same last bar check as the original)...
          __________________
          Bertrand, NinjaTrader Customer Service
          NinjaTrader is a FREE application for advanced charting, market analytics, system development and trade simulation.

          View schedule of upcoming online product training events.
          NinjaTrader_Bertrand is online now Report Post

          Comment


            #6
            Then for example you would need to check off the fill state for your order ID as well - http://www.ninjatrader-support.com/H...Functions.html

            To get all working orders on the NT account you could work with NTOrders.

            Easiest way still would be changing your TS code condition to not send that stream of orders but only one for your entry signal, you could do so with a bool flag for example.

            Please attach your log / traces from the day here so we could review for errors and to check if there were orders submitted to NT from your TS.

            Those diagnostic files would sit in the MyDocuments\NinjaTrader 6.5 > Log / Trace folders.

            Thanks
            BertrandNinjaTrader Customer Service

            Comment


              #7
              I am getting more and confused....Please understand I am not a programmer and you are now "talking over my head"....I have been with TS for 9 years and NT for about 5...in my EL strategy I just write buy next bar at limit and the thing only sends 1 order.... there is no need to limit the orders being sent because it only sends 1...so I have no idea how to perform that limiting code....and the people at TS won't tell you because your executing through NT....so this is a limitation from within NT...because obviously when placing an order manually in the dome it doesn't send off hundreds of orders...

              you guys are saying you have the technology to export TS generate signals but what you should say is that it only works if you can write the execution code (non ts code because you'd never need this in TS) yourself from scratch... where are the examples?....of how to send only 1 order....

              if you say this is available....it shouldn't be this difficult to get an answer or an example.....

              Comment


                #8
                Please follow the steps here to get the sample code installed into TS. You will then want to view the code through the code editor in TS. http://www.ninjatrader-support.com/H...tallation.html
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  come on....that is already done....How could I run the Nt sample from TS if it's not installed?

                  Comment


                    #10
                    Very simply all I want is an actual working example of how to send my TS Signals to an NT ATM.....I don't see why if you guys claims this is available and in fact on many of your broker partners websites they claim that it is simple..... "just drop in the built in functions" okay....show me how........

                    Comment


                      #11
                      9Baller,

                      I am not sure what you are asking for. The NTSample is a working sample that places orders when the moving averages cross.

                      It is very simple to do. Anywhere you have something like Buy() or SellShort() or something like that in TS you replace it with NTBuyMarket() or NTSellMarket() function.

                      If your TS code relied on EasyLanguage to prevent you from entering multiple times as you call Buy() over and over, that for sure will not work when you replace the EasyLanguage code with the NT methods. You need to reprogram your TS code to not rely on such a prevention check as no such check exists when you try to push orders to NT. Your TS code probably shouldn't rely on this to begin with anyways. It is essentially a fail safe you are relying on and TS for sure does not apply any such fail safe logic onto addon DLL methods like NTBuyMarket(). If this is over your head then unfortunately all I can suggest for you is to contact an EasyLanguage programmer.
                      Josh P.NinjaTrader Customer Service

                      Comment


                        #12
                        Point #1.....The NT sample strategy does not work....as I pointed earlier in this thread
                        Point #2....My strategy does not use market orders it uses limit as any experienced trader does....

                        Comment


                          #13
                          sorry was not finished...
                          Point #3....you are saying how simple it is to do but you are still missing the point....I AM NOT USING THOSE FUNCTIONS....NT BUYMarket or NTSell Market....I am using the NT command function....I do not wish to have my TS exits exported to NT because I wish to have the flexibility to adjust the stops manually if I see fit....If do this then I run the risk of a TS exit signal actually triggering an unintended short or vice versa so I would simply like to use an NT ATM to manage the exits....and have the entry signal sent over from TS..from what I was told the only way to call up an atm is with the NT command function using "place"....which is what I'm doing...if this is the incorrect way to call an ATM please advise.....

                          Point#4 now using the NT Command function with the "place" command in combination with a limit order is sending hundred of orders into the que.....this is where I need help....how to send only 1 limit order to NT....that's all...there is no limiting code in TS to prevent multiple orders being sent....it is invisible to the platform....so I have no way of knowing how to write such prevention as it does not exist in TS...

                          Point #5...someone in the past had enough knowledge of EL to write these functions....if that person is gone now then if your organization is going to advertise how easy this cross configuration is....you should have some examples of actually how to do it....I need about 3 lines of code is my guess....because again all I want is my entries sent over and the ATM to manage the exits.....

                          Comment


                            #14
                            9Baller, to clarify a few of the points you make:

                            1. The sample does work for a wide range of clients including on our test machines here - which TS and NT version are you using? And could you please send us your trace and log files to Support so we could investigate closer?

                            2. The Email interface we offer is designed as 'plug and play' solution, meaning no custom coding is needed.

                            3. However you could not call ATMs with the PLACE command with the email interface hence you would need to custom code it with the DLL interface functions - http://www.ninjatrader-support.com/H...Functions.html

                            The interface is more geared towards experienced programmers so if you need help in coding this out in EasyLanguage it might be best get involved with a consultant offering such services.

                            4. We can testdrive your custom code here on our end and offer suggestions, for this please attach the TS strategy here or send it along to support with your diagnostic files.

                            Thanks
                            BertrandNinjaTrader Customer Service

                            Comment


                              #15
                              I have almost exactly the same problem but with a stop order

                              I have
                              If MA1>MA2 then begin
                              If Marketposition=-1 then Success = NTBuystop("LEC",2,open next bar + .5*Range(2));
                              If Marketposition=0 then Success = NTBuystop("LEO",1,open next bar + .5*Range(2));
                              end;

                              This sends a million orders until NT crashes and i have to use Windows to end the program

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by GussJ, 03-04-2020, 03:11 PM
                              11 responses
                              3,221 views
                              0 likes
                              Last Post xiinteractive  
                              Started by andrewtrades, Today, 04:57 PM
                              1 response
                              10 views
                              0 likes
                              Last Post NinjaTrader_Manfred  
                              Started by chbruno, Today, 04:10 PM
                              0 responses
                              6 views
                              0 likes
                              Last Post chbruno
                              by chbruno
                               
                              Started by josh18955, 03-25-2023, 11:16 AM
                              6 responses
                              436 views
                              0 likes
                              Last Post Delerium  
                              Started by FAQtrader, Today, 03:35 PM
                              0 responses
                              9 views
                              0 likes
                              Last Post FAQtrader  
                              Working...
                              X