Multi-symbol robots and indicators

28 Nov 2015, 19:11Multi-symbol robots and indicators#31
Roni Zbaidaposts: 32since: 01 Jan 2015

In a multi-symbol cBot, will the OnTick() method trigger for each incoming tick on every symbol used, or just on incoming ticks of the associated chart? Do I need to write code to check if Bid/Ask price changed on each symbol, and trigger an event for such occurrence?

28 Nov 2015, 19:12RE: OnTick() in multi-symbol cBots#32
Roni Zbaidaposts: 32since: 01 Jan 2015

Spotware said:

Dear Trader,

It's not possible. You could collect bid and ask prices in RunTime and then access them. 

In a multi-symbol cBot, will the OnTick() method trigger for each incoming tick on every symbol used, or just on incoming ticks of the associated chart? Do I need to write code to check if Bid/Ask price changed on each symbol, and trigger an event for such occurrence?

28 Nov 2015, 19:16OnTick() in multi-symbol cBots#33
Roni Zbaidaposts: 32since: 01 Jan 2015

In a multi-symbol cBot, will the OnTick() method trigger for each incoming tick on every symbol used, or just on incoming ticks of the associated chart? Do I need to write code to check if Bid/Ask price changed on each symbol, and trigger an event for such occurrence?

30 Nov 2015, 20:26#34
Spotware Teamposts: 3344since: 23 Sep 2013

Dear Trader,

OnTick() method is triggered on each incoming tick of the Symbol your cBot is set to run. 


TRADERS FIRST™ Vote for your favorite features: http://vote.spotware.com/
22 Apr 2016, 06:12#35
oneplusocposts: 32since: 09 Mar 2015

Dear all

how i can  draw the value only  of the rsi on the chart for multi time frame

for this indicator ?

 

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

namespace cAlgo.Indicators
{
    [Levels(30, 70, 80, 20)]

    [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC)]
    public class MultiSymbolMA : Indicator
    {
        private RelativeStrengthIndex ma1, ma2, ma3, ma4;
        private MarketSeries series1, series2, series3, series4;
        private Symbol symbol1, symbol2, symbol3, symbol4;

        [Parameter(DefaultValue = "USDCAD")]
        public string Symbol1 { get; set; }

        [Parameter(DefaultValue = "EURAUD")]
        public string Symbol2 { get; set; }

        [Parameter(DefaultValue = "EURJPY")]
        public string Symbol3 { get; set; }

        [Parameter(DefaultValue = "GBPUSD")]
        public string Symbol4 { get; set; }

        [Parameter(DefaultValue = 5)]
        public int Period { get; set; }

        [Output("MA Symbol 1", Color = Colors.Red, PlotType = PlotType.Line, Thickness = 1)]
        public IndicatorDataSeries Result1 { get; set; }

        [Output("MA Symbol 2", Color = Colors.Magenta, PlotType = PlotType.Line, Thickness = 1)]
        public IndicatorDataSeries Result2 { get; set; }

        [Output("MA Symbol 3", Color = Colors.Yellow, PlotType = PlotType.Line, Thickness = 1)]
        public IndicatorDataSeries Result3 { get; set; }

        [Output("MA Symbol 4", Color = Colors.White, PlotType = PlotType.Line, Thickness = 1, LineStyle = LineStyle.Dots)]
        public IndicatorDataSeries Result4 { get; set; }

        protected override void Initialize()
        {
            symbol1 = MarketData.GetSymbol(Symbol1);
            symbol2 = MarketData.GetSymbol(Symbol2);
            symbol3 = MarketData.GetSymbol(Symbol3);
            symbol4 = MarketData.GetSymbol(Symbol4);

            series1 = MarketData.GetSeries(symbol1, TimeFrame);
            series2 = MarketData.GetSeries(symbol2, TimeFrame);
            series3 = MarketData.GetSeries(symbol3, TimeFrame);
            series4 = MarketData.GetSeries(symbol4, TimeFrame);

            ma1 = Indicators.RelativeStrengthIndex(series1.Close, Period);
            ma2 = Indicators.RelativeStrengthIndex(series2.Close, Period);
            ma3 = Indicators.RelativeStrengthIndex(series3.Close, Period);
            ma4 = Indicators.RelativeStrengthIndex(series4.Close, Period);

        }

        public override void Calculate(int index)
        {
            ShowOutput(symbol1, Result1, ma1, series1, index);
            ShowOutput(symbol2, Result2, ma2, series2, index);
            ShowOutput(symbol3, Result3, ma3, series3, index);
            ShowOutput(symbol4, Result4, ma4, series4, index);
        }

        private void ShowOutput(Symbol symbol, IndicatorDataSeries result, RelativeStrengthIndex RelativeStrengthIndex, MarketSeries series, int index)
        {

            int index2 = GetIndexByDate(series, MarketSeries.OpenTime[index]);

            result[index] = RelativeStrengthIndex.Result[index2];

            string text = string.Format("{0} {1}", symbol.Code, Math.Round(result[index], 0));

            ChartObjects.DrawText(symbol.Code, text, index + 1, result[index], VerticalAlignment.Center, HorizontalAlignment.Right, Colors.Yellow);

        }
        private int GetIndexByDate(MarketSeries series, DateTime time)
        {
            for (int i = series.Close.Count - 1; i >= 0; i--)
                if (time == series.OpenTime[i])
                    return i;
            return -1;
        }
    }
}

22 Apr 2016, 11:02#36
Spotware Teamposts: 3344since: 23 Sep 2013

Dear Trader,

We do not provide coding assistance services. We more than glad to assist you with specific questions about cAlgo.API. You can contact one of our Partners or post a job in Development Jobs section for further coding assistance.


TRADERS FIRST™ Vote for your favorite features: http://vote.spotware.com/
21 Mar 2017, 03:24#37
brianchan661posts: 11since: 15 Jul 2016

Dear team,

Is multi symbol still not avaiable for back testing yet?

Thanks

21 Mar 2017, 03:24#38
brianchan661posts: 11since: 15 Jul 2016

Dear team,

Is it still not avaiable for backtesting yet?

Thanks

18 Dec 2017, 20:06RE:#39
gunning.ernieposts: 12since: 18 Dec 2017

Spotware said:

Dear Trader,

OnTick() method is triggered on each incoming tick of the Symbol your cBot is set to run. 

Hi Guys,

This is a problem, a trading strategy should not be limited to one symbol ontick feed. We have a 1 to many relationship here as I have 1strategy being applied accrosss many symbols AND timeframes. I would siggests a Pubish subscribe pattern were so my bot can register to all the symbol ontick data feeds it wants to receive. Otherwise my other symbols which is not related to the bot's chart is only getting their updated data bassed on the chart's symbol so i will definitaly be delayed on my other symbols for data.

Hope im making sense,

This is a HUGEt issue for me...

A timer is not an option as I'm trading fundamentals (calendar news) and with a huge news events every micro second count. 

Any suggestions?

18 Dec 2017, 20:17RE:#40
gunning.ernieposts: 12since: 18 Dec 2017

Spotware said:

Dear Trader,

OnTick() method is triggered on each incoming tick of the Symbol your cBot is set to run. 

Hi Guys,

This is a big one for me. You cant have a trading strategy tied to 1 chart (one symbol and time frame). a trading strategy can be applied to many symbols and many timeframes. So you have a 1 to many relationship here apose to 1 to 1.

If my cbot trades 5 pairs and I register the bot to 1 chart of the 4 AND with what you telling me is that I will only receive ontick events for the 1 symbol on the chart, right? 

 

AND what you suggesting is to get the other symbols data on the Chats OnTick event... then the 4 symbols would only be processed when symbol 1 has a OnTick event. THIS IS A HUGE RISK TO ME

I would like to trade the calendar fundamentals and a micro split second is very important. Thus a timer based approach is also not feasable..

Is there no pub & sub (publish and subscribe pattern) were I can subscribe to for Ontick feeds for multiple symbols?