Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

copier in VPS

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

    copier in VPS

    Hi,

    I have a copier locally that is working perfectly. I would like to be able to do it by copying it to my VPS, any idea of ​​what library or how I could do it?
    tk






    Code:
    private void OnOrderUpdate(object sender, OrderEventArgs e)
                {
                    int quantity = OrderQuantity;
                    
                    if (!IsCopyAllowed) return;
                    
                    // ----------   ENRTY LONG/SHORT   -----------------------
                    if (e.Order.Account == MasterAccount && e.Order.Instrument == Instrument)
                        {
                            if (e.OrderState == OrderState.Submitted && e.Order.IsMarket && e.OrderState != OrderState.CancelSubmitted )
                                {
                                    if (Acc1 != null ) sendOrder(Acc1, e.Order.OrderAction, e.Order.OrderType, quantity, e.Order.OrderId );
                                    if (Acc2 != null ) sendOrder(Acc2, e.Order.OrderAction, e.Order.OrderType, quantity, e.Order.OrderId );
                                    if (Acc3 != null ) sendOrder(Acc3, e.Order.OrderAction, e.Order.OrderType, quantity, e.Order.OrderId );
                                    if (Acc4 != null ) sendOrder(Acc4, e.Order.OrderAction, e.Order.OrderType, quantity, e.Order.OrderId );
                                    if (Acc5 != null ) sendOrder(Acc5, e.Order.OrderAction, e.Order.OrderType, quantity, e.Order.OrderId );
                                    if (Acc6 != null ) sendOrder(Acc6, e.Order.OrderAction, e.Order.OrderType, quantity, e.Order.OrderId );
                                    if (Acc7 != null ) sendOrder(Acc7, e.Order.OrderAction, e.Order.OrderType, quantity, e.Order.OrderId );
                                    if (Acc8 != null ) sendOrder(Acc8, e.Order.OrderAction, e.Order.OrderType, quantity, e.Order.OrderId );
                                    if (Acc9 != null ) sendOrder(Acc9, e.Order.OrderAction, e.Order.OrderType, quantity, e.Order.OrderId );
                                }
                        }
                        //---
                    if (e.Order.Account == MasterAccount && e.Order.Instrument == Instrument)
                        {
                            if ( e.OrderState == OrderState.Filled && ( e.Order.IsLimit || e.Order.IsStopMarket ) )
                                {
                                    if (Acc1 != null ) sendOrder(Acc1, e.Order.OrderAction, OrderType.Market, quantity, e.Order.OrderId );
                                    if (Acc2 != null ) sendOrder(Acc2, e.Order.OrderAction, OrderType.Market, quantity, e.Order.OrderId );
                                    if (Acc3 != null ) sendOrder(Acc3, e.Order.OrderAction, OrderType.Market, quantity, e.Order.OrderId );
                                    if (Acc4 != null ) sendOrder(Acc4, e.Order.OrderAction, OrderType.Market, quantity, e.Order.OrderId );
                                    if (Acc5 != null ) sendOrder(Acc5, e.Order.OrderAction, OrderType.Market, quantity, e.Order.OrderId );
                                    if (Acc6 != null ) sendOrder(Acc6, e.Order.OrderAction, OrderType.Market, quantity, e.Order.OrderId );
                                    if (Acc7 != null ) sendOrder(Acc7, e.Order.OrderAction, OrderType.Market, quantity, e.Order.OrderId );
                                    if (Acc8 != null ) sendOrder(Acc8, e.Order.OrderAction, OrderType.Market, quantity, e.Order.OrderId );
                                    if (Acc9 != null ) sendOrder(Acc9, e.Order.OrderAction, OrderType.Market, quantity, e.Order.OrderId );
                                }
                        }
            }
            //---
            private void sendOrder(Account acc, OrderAction ordAction, OrderType ordType, int OrderQuantity, string ordName)
                {
                    
                    if (!IsCopyAllowed) return;
                    Order ordToSend = null;
                    ordToSend = acc.CreateOrder(Instrument, ordAction, ordType, OrderEntry.Manual, TimeInForce.Day, OrderQuantity ,0, 0, "", ordName, DateTime.MaxValue, null);
                    acc.Submit(new[] { ordToSend });
                }​

    #2
    Hello leojimenezp,

    To use NinjaScript on the VPS you would need to install NinjaTrader and then copy the script to the vps. The easiest way would be to use the export/import feature to make an importable zip file then transfer that file to the vps and import it.


    Comment


      #3
      Hi
      No, I don't think I have been able to explain myself, what I want is that the code I have where I copy my entries to my other accounts on the same computer (which works correctly), I also want to copy them to a ninja merchant with a fixed IP address (VPS) . do a copytrade.

      Comment


        #4
        Hello leojimenezp,

        That would not be something our support could assist with. You can search online for C# examples of doing client/server tasks. There is nothing in NinjaScript which would offer that functionality.

        Comment


          #5
          tk,


          I am creating a socket from an example I saw. I thought ninja had a bookstore so I could do it better
          Code:
          sender = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); IPAddress ipAddress = IPAddress.Parse("127.0.0.2"); // IP address of the server IPEndPoint remoteEP = new IPEndPoint(ipAddress, 12345); // Server port sender.Connect(remoteEP);

          Comment


            #6
            Hello leojimenezp,

            You would need to use external C# learning resources for this question, our support cannot provide general C# assistance. We can help with NinjaScript specific topics, items that are covered in the help guide NinjaScript manual. Websockets are not part of NinjaScript, that would be a C# concept.

            Comment


              #7
              We would be happy to help you with this. Reach out to our 24/7 support team at [redacted]
              QuantVPS
              NinjaTrader Ecosystem Vendor - QuantVPS

              Comment


                #8
                Hello QuantVPS,

                Thanks for your input.
                Unfortunately, I've had to remove the link from your post.
                To ensure a fair forum environment that isn't filled with advertisement, our policy is to remove links to third party sites that are not educational.
                It can helpful to discuss a vendor product, however if you have links to non-educational material such as product sites please consider sending these as a private message to the recipient.​
                Chelsea B.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                559 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                324 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                101 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                546 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                547 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X