Replies

GammaQuant
02 Nov 2022, 01:25

Dont know what the problem was as the above did not solve it. But i reinstalled windows 10 and it fixed the issue.. Thanks. It must have been some kind of file write permission problem or something.


@GammaQuant

GammaQuant
28 Nov 2018, 14:52

Hi Panagiotis, Ohh ok... that food for thought!

Thanks for that i will investigate that with you guys or my broker closer to when im ready.

Regards

 


@GammaQuant

GammaQuant
26 Nov 2018, 18:43

Hi Panagiotis, Thank you for that...

I think you guys should really do this as it will give a whole new marketplace access to ctrader.. there is not many other software platforms based on C# as well and the ones that are, are not connected to great brokers anyway...

Next time you guys discuss this please make a plan to really do it..

Its also something i am working towards as well (Like Seriously around 6-12 months time)

But i am happy for the moment with the current setup.

Regards


@GammaQuant

GammaQuant
26 Nov 2018, 17:36

Ahh... Thank you... i was not sure, thought i would ask.


@GammaQuant

GammaQuant
23 Nov 2018, 20:37

Hi Panagiotis Charalampous is trhere any chance that you guy can addd UI automation to the API so we can control cTrader UI elements and charts from code? this is something im verty interested in as well. Thank you


@GammaQuant

GammaQuant
23 Nov 2018, 20:30

I suppose every trader needs to go through the "Martingale" stage in there trading journey as a rites of passage..........


@GammaQuant

GammaQuant
03 Sep 2018, 16:38

Hi do you have a rough idea when you will roll out? is this going to happen soon? at least this year?......


@GammaQuant

GammaQuant
21 May 2018, 18:26

RE: RE:

Sorry forget the above.........


@GammaQuant

GammaQuant
21 May 2018, 17:16

RE:

Panagiotis Charalampous said:

Hi GammaQuant,

Unfortunately you cannot tell for which Symbol was the OnTick() called.

Best Regards,

Panagiotis

Hi Panagiotis

thank you for the last reply

Ok so i was trying to make some kind of work around property that invoke my own tick method on change but cAlgo wont build and gives me an error:

Unable to load assembly: "EurUsd" parameter must be an auto-property

using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;

namespace cAlgo
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class MultiSymbolTest : Robot
    {
        [Parameter(DefaultValue = 0.0)]
        public double Parameter { get; set; }

        public SymbolEvent EurUsd
        {
            get { return EurUsd; }
            set
            {
                var eurUsd = MarketData.GetSymbol("EURUSD");
                EurUsd = new SymbolEvent 
                {
                    Bid = eurUsd.Bid,
                    Ask = eurUsd.Ask
                };
                MyOnTick(eurUsd);
            }
        }

        protected override void OnStart()
        {
            // Put your initialization logic here
            var EURUSD = MarketData.GetSymbol("EURUSD");
            //var GBPUSD = MarketData.GetSymbol("GBPUSD");
            //var EURJPY = MarketData.GetSymbol("EURJPY");
            //var USDJPY = MarketData.GetSymbol("USDJPY");
        }

        /*protected override void OnTick()
        {
            // Put your core logic here
            Print("Symbol -" + Symbol.Code + " |  Bid = " + Symbol.Bid);
        }*/

        private void MyOnTick(Symbol symbol)
        {
            Print("Symbol -" + Symbol.Code + " |  Bid = " + Symbol.Bid);
        }

        protected override void OnStop()
        {
            // Put your deinitialization logic here
        }
    }

    public struct SymbolEvent
    {
        public double Ask;
        public double Bid;
    }
}

Wht is the situation with preset properties and calgo?


@GammaQuant

GammaQuant
17 May 2018, 23:43

Multi-symbol robots and indicators - Which Symbol Invoked OnTick?????

Hi Panagiotis or anyone else who knows

on testing this code above the cAlgo Symbol Interface only returns symbol data for the symbol that is selected with calgo to run the robot with but will invoke on ticks from the four symbols entered in the OnStart method.

using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;
 
namespace cAlgo
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class NewcBot : Robot
    {
        [Parameter(DefaultValue = 0.0)]
        public double Parameter { get; set; }
 
        protected override void OnStart()
        {
            var EURUSD = MarketData.GetSymbol("EURUSD");
            var GBPUSD = MarketData.GetSymbol("GBPUSD");
            var EURJPY = MarketData.GetSymbol("EURJPY");
            var USDJPY = MarketData.GetSymbol("USDJPY");
        }
 
        protected override void OnTick()
        {
            Print("Symbol -" + Symbol.Code + " |  Bid = " + Symbol.Bid );
        }
 
        protected override void OnStop()
        {
            // Put your deinitialization logic here
        }
    }
}

How do i tell OnTick Method or Symbol Interface which Symbol Invoked it?


@GammaQuant

GammaQuant
21 Sep 2017, 17:11

I think i will use Named Pipes as there are much more examples and tutorials around to help me set up WCF than i have found for MMF. i also think it will be better for what i am doing as i want each instance to send mesaages to the master when anything significant happens on ticks coming in Asynchronously and also the master to send messages to the slaves. WCF looks like it will handle message queuing and other underlying stuff so i think thats the best direction for me to take. if i get into any problems with this in calgo i will ask your advice again. Thank you very much Panagiotis


@GammaQuant

GammaQuant
21 Sep 2017, 16:07

RE:

Panagiotis Charalampous said:

Hi GammaQuant,

Thanks for the links. There is a mention in one of them that you could use static collections to share variables between cBots but this is not possible. I assume that the person that suggested this never actually tried it. The reason that this cannot happen is that you cannot compile more than two cBots in the same dll. As a result, each cBot exists in a different dll and they cannot share variables between them. If you need to share information between cBots maybe you can consider reading and writing to a file accessible by both. Let me know if this suggestion helps.

Best Regards,

Panagiotis

Hi Panagiotis Ok so this is not possible then for sure.....

I am building a high performance trading system that will be running over 10 to 30 instances with a master instance controlling the other intances. As this is quite a complex system i dont want the performance to suffer so after lots of research on the available options i could take i have thought about doing this with WCF Named Pipe Binding with Protobuf serialization or doing it with Memory Mapped Files. i have never dont this before having only started programming c# 4 months ago so any advice would be appreciated.

Thank you.


@GammaQuant

GammaQuant
21 Sep 2017, 15:12

if (!tradeTime && _todaysOrderExecuted)
    {
        _todaysOrderExecuted = false;
    }

Sorry missing Parentheses


@GammaQuant

GammaQuant
21 Sep 2017, 11:36

Hi TMC i wonder if you can help me in this thread please

/forum/cbot-support/11907?page=1#3


@GammaQuant

GammaQuant
21 Sep 2017, 11:34

RE:

Panagiotis Charalampous said:

Hi GammaQuant,

It is not possible to share static variables between cBots. Where have you seen this? Do you mind sharing a link? Maybe it was about something else.

Best Regards,

Panagiotis

Hi Panagiotis here are Three:

/forum/calgo-support/11288

/forum/cbot-support/11619?page=1

/forum/cbot-support/10908?page=2


@GammaQuant

GammaQuant
21 Sep 2017, 04:12

[Parameter("Start Hour", DefaultValue = 6.0)]
public double StartTime { get; set; }
 
[Parameter("Stop Hour", DefaultValue = 18.0)]
public double StopTime { get; set; }


private bool _todaysOrderExecuted;



protected override void OnBar()
{
    var currentHours = Server.Time.TimeOfDay.TotalHours;
    bool tradeTime = StartTime < StopTime
                ? currentHours > StartTime && currentHours < StopTime
                : currentHours < StopTime || currentHours > StartTime;

    if (tradeTime && !_todaysOrderExecuted)
    {
       ExecuteStrategy();
    }
    if (!tradeTime && _todaysOrderExecuted
    {
        _todaysOrderExecuted = false;
    }
}

private void ExecuteStrategy()
{
*** Execute strategy code****
    if (result.IsSuccessful)
    {
        _todaysOrderExecuted = true;
    }
}

this will allow you to only trade between certain times of the day and will only open one trade per day. it will use the servertime in calgo. dont use Datetime as that is the time in your computer and not the brokers Server time.


@GammaQuant

GammaQuant
21 Sep 2017, 03:38

For a start the are two OnStart Methods. obviously it wont work with two.

this function :

 

protected override void OnBar()
        {
            ExecuteMarketOrder(TradeType.Buy, Symbol, Volume, "BUY");
            ExecuteMarketOrder(TradeType.Sell, Symbol, Volume, "SELL");
            foreach (var position in Positions)
            {
 
                if (position.Pips > 4.3)
                (
                    ClosePosition(position)

                    

should be

protected override void OnBar()
        {
            ExecuteMarketOrder(TradeType.Buy, Symbol, Volume, "BUY");
            ExecuteMarketOrder(TradeType.Sell, Symbol, Volume, "SELL");
            foreach (var position in Positions)
            {

                if (position.Pips > 4.3)
                {
                    ClosePosition(position);
                }
            }
        }

I dont understand what you are trying to achive with the rest of it....


@GammaQuant

GammaQuant
28 Jul 2017, 10:16 ( Updated at: 28 Jul 2017, 10:17 )

Seriously stop and download Visual studio 2015 CE (it free) and follow the instructions on the forum to set it up with cAlgo. the IDE in cAlgo is not just missing an undo feature compared to Visual Studio.......


@GammaQuant

GammaQuant
28 Jul 2017, 10:13 ( Updated at: 28 Jul 2017, 10:14 )

Ive not tested your problem but cant you just close each one with close position Asyc in a loop if it meets your requirements to close? And setup an onPossitonClosed callback to make sure they closed?


@GammaQuant

GammaQuant
25 Jul 2017, 17:38

Thank you very much for that Wow that obvious isn't it...... :). Sorry ive only be programing c# for 1.5 months. but i exspanded on your solution so that i only have to pass it once in the onstart and then i use a static method every where i invoke calgo api methods out side of the main class and any methods within the main class from any other of the classes that ive created for my framework. Thank you

using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;

namespace cAlgo
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class Printer : Robot
    {
        [Parameter(DefaultValue = 0.0)]
        public double Parameter { get; set; }


        private PrintSub _demo;

        protected override void OnStart()
        {
            // Put your initialization logic here
            Po.Load(this);
            _demo = new PrintSub();
        }

        protected override void OnTick()
        {
            // Put your core logic here
        }

        protected override void OnBar()
        {
            // Put your core logic here
            _demo.POnBar();
        }

        protected override void OnStop()
        {
            // Put your deinitialization logic here
        }

        public void MainPrinter()
        {
            int index = MarketSeries.Close.Count - 2;
            Print("Hello World Main - Last Bar Close Price {0}", MarketSeries.High[index]);
            ExecuteMarketOrder(TradeType.Buy, Symbol, 100000, "Printer", 5, 5);
        }
    }

    public class PrintSub : Printer
    {

        public void POnBar()
        {
            var price = Po.Go().MarketSeries.Open.LastValue;
            Po.Go().Print("Hello World - Bar Open Price {0}", price);
            PrintInMainRobot();
        }

        public void PrintInMainRobot()
        {
            Po.Go().MainPrinter();
        }
    }

    public static class Po
    {
        public static Printer MainClass;

        public static void Load(Printer mainClass)
        {
            MainClass = mainClass;
        }

        public static Printer Go()
        {
            return MainClass;
        }
    }
}

 


@GammaQuant