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

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.


    JesseNinjaTrader Customer Service

    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.

        JesseNinjaTrader Customer Service

        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.
            JesseNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by joseph_kuruvilla12, Today, 01:01 AM
            0 responses
            6 views
            0 likes
            Last Post joseph_kuruvilla12  
            Started by joseph_kuruvilla12, Today, 12:40 AM
            0 responses
            4 views
            0 likes
            Last Post joseph_kuruvilla12  
            Started by joseph_kuruvilla12, Today, 12:13 AM
            0 responses
            5 views
            0 likes
            Last Post joseph_kuruvilla12  
            Started by stafe, 07-19-2024, 01:32 PM
            3 responses
            40 views
            0 likes
            Last Post stafe
            by stafe
             
            Started by joseph_kuruvilla12, Yesterday, 10:29 PM
            0 responses
            5 views
            0 likes
            Last Post joseph_kuruvilla12  
            Working...
            X