Topics
30 Aug 2017, 11:07
 0
 3249
 3
28 Apr 2017, 14:00
 2177
 2
31 Mar 2017, 09:27
 2710
 3
30 Mar 2017, 11:50
 3453
 7
29 Mar 2017, 16:02
 2692
 7
29 Mar 2017, 10:48
 2124
 3
12 Mar 2017, 13:53
 2262
 2
01 Mar 2017, 22:40
 1798
 4
22 Feb 2017, 21:02
 2135
 1
22 Feb 2017, 19:48
 2539
 5
08 Feb 2017, 13:58
 6038
 14
03 Feb 2017, 10:03
 0
 2106
 1
Replies

mindbreaker
24 Jan 2015, 22:21

RE: Socket Connections

cAlgo server:

 

using System;
using System.Text;
using System.Linq;
using System.Net;
using System.Threading;
using System.Net.Sockets;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;


namespace cAlgo
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.FullAccess)]
    public class Server : Robot
    {
        [Parameter(DefaultValue = 8888)]
        private int Port { get; set; }

        public static string ClientData = "";

        public TcpListener Myserver = null;
        public TcpClient client = null;

        protected override void OnStart()
        {


            Thread t1 = new Thread(p => { ServerCopier(); });
            t1.Start();


        }


        protected override void OnTick()
        {
            Print("Tick Tak Tok");
            Print("Data from client[OnBar]: " + ClientData);
            var name = "Up";
            var text = "Received : " + ClientData;
            var staticPos = StaticPosition.TopRight;
            var color = Colors.Green;
            ChartObjects.DrawText(name, text, staticPos, color);

        }

        public void ServerCopier()
        {

            try
            {
                // Set the TcpListener on port
                Int32 port = Port;
                IPAddress localAddr = IPAddress.Parse("127.0.0.1");

                // TcpListener server = new TcpListener(port);
                Myserver = new TcpListener(localAddr, port);

                // Start listening for client requests.
                Myserver.Start();

                // Buffer for reading data
                Byte[] bytes = new Byte[1024];
                String data = null;

                // Enter the listening loop. 
                while (true)
                {
                    Print("Waiting for a connection... ");

                    // Perform a blocking call to accept requests. 
                    // You could also user server.AcceptSocket() here.
                    client = Myserver.AcceptTcpClient();
                    Print("Connected!");

                    data = null;

                    // Get a stream object for reading and writing
                    NetworkStream stream = client.GetStream();

                    int i;

                    // Loop to receive all the data sent by the client. 
                    while ((i = stream.Read(bytes, 0, bytes.Length)) != 0)
                    {
                        // Translate data bytes to a ASCII string.
                        data = System.Text.Encoding.ASCII.GetString(bytes, 0, i);
                        Print("Received: {0}", data);
                        ClientData = "" + data;

                        Print("Tick Tak Tok");
                        Print("Data from client[OnBar]: " + ClientData);
                        var name = "Up";
                        var text = "Received : " + ClientData;
                        var staticPos = StaticPosition.TopRight;
                        var color = Colors.Green;
                        ChartObjects.DrawText(name, text, staticPos, color);

                        string pos = Symbol.Spread + " XX ";
                        foreach (var pendingOrder in PendingOrders)
                        {
                            pos = pos + pendingOrder.TradeType + "XX" + pendingOrder.Volume + "XX" + pendingOrder.Id + "XXXX";
                        }



                        data = pos.ToUpper();
                        byte[] msg = System.Text.Encoding.ASCII.GetBytes(data);

                        // Send back a response.
                        stream.Write(msg, 0, msg.Length);
                        Print("Sent: {0}", data);
                    }

                    // Shutdown and end connection
                    client.Close();
                }
            } catch (SocketException e)
            {
                Print("SocketException: {0}", e);
            } finally
            {
                // Stop listening for new clients.
                client.Close();
                Myserver.Stop();
            }
        }


        protected override void OnStop()
        {
            client.Close();
            Myserver.Stop();
            Print("Server stoped.");
        }

    }
}

 


@mindbreaker

mindbreaker
21 Jan 2015, 17:45 ( Updated at: 21 Dec 2023, 09:20 )

Fees

Hi,

Trader should be rewarded for profits, something -->  X percentage of the earned money in month.

100 Pips on GBPJPY from 1mn => 10.000,00$ for Investor but Trader earn 10-25$  it is funny :)

Trader ==

This system is good for broker not for Trader

Have a nice Day.


@mindbreaker

mindbreaker
21 Jan 2015, 13:57

RE: Cbot FireBot

Hi,

Deposit 100$ one position in week 0.01 on week open price => 25% per week (on GBPJPY, GBPNZD ...)

it is good profit for me if You need more (its a lot of money in the year):

Learn and write something more meaningful and not coming up with.

Such wises there is a lot but nobody has written a reasonable solution.

Nice day.


@mindbreaker

mindbreaker
21 Jan 2015, 13:39 ( Updated at: 21 Dec 2023, 09:20 )

Error

Hi,

it something wrong with server data:

and

Bye.

 


@mindbreaker

mindbreaker
21 Jan 2015, 13:12

RE: Fees

Hi,

Why demo accounts can not set the fees - it's discrimination.

Add the possibility of adding users who can copy signals - why some beetroot from NY(for example) can make money on my education for free or without my permission.

Or add list users who copy signals and add posibility to ban them.

And why sometimes on my signal provider account i see doubled positions :D

Bye

 


@mindbreaker

mindbreaker
21 Jan 2015, 12:12

Fees

modarkat said:

Have you checked cMirror ?


Hi spotware,

is it possible to set any commissions when I set signal provider account?

What is the maximum commissions of 1mn  can be set up?

Thanks


@mindbreaker