Multi-symbol robots and indicators

Denis 's avatar
Denis  since: 04 Feb 2014; 
 22 Jan 2015, 23:19
Multi-symbol robots and indicators

You may want to look into cAlgo built in function GetIndexByTime() instead of using your own. Testing for exact equality of DateTimes may be a problem, just a wild guess.

Romanov Capital -- NDD STP broker \\\ https://en.romanovcapital.com \\\ Custom Robot and Indicator development \\\ email: calgo(at)romanovcapital.com
Denis 's avatar
Denis  since: 04 Feb 2014; 
 06 Feb 2015, 15:55

Spotware, are there any short term plans to support multisymbol cBots in backtesting?

There are some support internally as commission for the same volume for pairs like GBPCAD are different on different days in backtesting, so cross rates to the account currency (USD in my case) are properly accounted for, so they should be downloaded and stored from the server already. Thus, implementing multi currency cBots backtesting should be a couple of steps away.

Caching tick/minute bars data on first invocation of GetSymbol() would be ok for the selected period of backtest so that backtesting engine would not cache all possible symbols present in the broker's cTrader after the user clicks the play button. If caching in the middle of the backtest run requires too many internal changes, you may add UI with a list of checkboxes and the user would have to select which pairs would be used in the backtest or optimization. If the data has not been explicitly cached for the symbol requested via GetSymbol() you may throw an exception. Adding UI for currencies would also cater for data in CSV files, they can be loaded individually for the respective symbols or the format of CSV could be enhanced to include the symbol in each line of the file.

Romanov Capital -- NDD STP broker \\\ https://en.romanovcapital.com \\\ Custom Robot and Indicator development \\\ email: calgo(at)romanovcapital.com
cTrader Team's avatar
cTrader Team since: 23 Sep 2013; 
 10 Feb 2015, 10:44
RE:

AlexanderRC said:

Spotware, are there any short term plans to support multisymbol cBots in backtesting?

There are some support internally as commission for the same volume for pairs like GBPCAD are different on different days in backtesting, so cross rates to the account currency (USD in my case) are properly accounted for, so they should be downloaded and stored from the server already. Thus, implementing multi currency cBots backtesting should be a couple of steps away.

Caching tick/minute bars data on first invocation of GetSymbol() would be ok for the selected period of backtest so that backtesting engine would not cache all possible symbols present in the broker's cTrader after the user clicks the play button. If caching in the middle of the backtest run requires too many internal changes, you may add UI with a list of checkboxes and the user would have to select which pairs would be used in the backtest or optimization. If the data has not been explicitly cached for the symbol requested via GetSymbol() you may throw an exception. Adding UI for currencies would also cater for data in CSV files, they can be loaded individually for the respective symbols or the format of CSV could be enhanced to include the symbol in each line of the file.

Dear AlexanderRC,

Thank you for your suggestions. Probably we will implement first version of multisymbol backtesting in very similar way with that you described. However multisymbol backtesting is not in our short term road map.

TRADERS FIRST™ Vote for your favorite features: http://vote.spotware.com/
Denis 's avatar
Denis  since: 04 Feb 2014; 
 13 Feb 2015, 02:03

If someone else craves for this feature, please vote for Multi-Currency Backtesting on vote.spotware.com

Romanov Capital -- NDD STP broker \\\ https://en.romanovcapital.com \\\ Custom Robot and Indicator development \\\ email: calgo(at)romanovcapital.com
inferno285 since: 24 May 2015; 
 24 May 2015, 00:58

A few days ago I had a working indicator showing other pair's averages, now it won't show up. I tried all the examples posted in this thread that use MarketData.GetSeries and every time if I took at that line then it would show up on cTrader. Please help.

Stephen

cTrader Team's avatar
cTrader Team since: 23 Sep 2013; 
 12 Jun 2015, 17:59
RE:

inferno285 said:

A few days ago I had a working indicator showing other pair's averages, now it won't show up. I tried all the examples posted in this thread that use MarketData.GetSeries and every time if I took at that line then it would show up on cTrader. Please help.

Stephen

Dear Trader,

Could you please press Ctrl+Alt+Shift+T when you observe this issue?

It will submit troubleshooting information to our support team.

TRADERS FIRST™ Vote for your favorite features: http://vote.spotware.com/
Roni Zbaida's avatar
Roni Zbaida since: 01 Jan 2015; 
 06 Sep 2015, 02:16
RE:

cAlgo_Development said:

We added new functionality to cAlgo - the ability for robots and indicators to work with multiple symbols. Now it's possible to use multiple symbol prices, OHLCV series and trade different symbols.

Requesting symbol

Robots and indicators can request a symbol specifying its symbol code. Symbol objects behave like the default Symbol object of a robot or indicator, containing current Ask, Bid, PipSize and other useful properties.

Symbol symbol = MarketData.GetSymbol("USDJPY");

Print("Symbol: {0}, Ask: {1}, Bid: {2}", symbol.Code, symbol.Ask, symbol.Bid);

Requesting OHLCV series

Robots and indicators can request OHLCV series for multiple symbols and timeframes and build indicators based on it.

MarketSeries series = MarketData.GetSeries("EURCAD", TimeFrame.Minute15);
MovingAverage ma = Indicators.SimpleMovingAverage(series.Close, 20);

Print("Symbol: {0}, TimeFrame: {1}", series.SymbolCode, series.TimeFrame);
Print("Last Close: {0}, Average Close: {1}", series.Close.LastValue, ma.Result.LastValue);

Trading multiple symbols

Robots in cAlgo can execute orders for different symbols. To do this, the robot must request the needed symbol by its code. Then, it will be possible to use it in a trade request:

 Symbol symbol = MarketData.GetSymbol("GBPCHF");
 ExecuteMarketOrder(TradeType.Buy, symbol, 10000);

The new version of our Demo cTrader and cAlgo is released and can be downloaded from www.spotware.com

Backtesting of Multi-symbol robots in not supported at least for now. It can be implemented in future.

Is it possible to access bid/ask as time series? i.e. bid[index]. I don't see t1 as option timeframe  MarketData.GetSeries("EURUSD", TimeFrame.t1), or is that something I would have to build myself?

Thanks

Roni Zbaida's avatar
Roni Zbaida since: 01 Jan 2015; 
 06 Sep 2015, 02:16
RE:

cAlgo_Development said:

We added new functionality to cAlgo - the ability for robots and indicators to work with multiple symbols. Now it's possible to use multiple symbol prices, OHLCV series and trade different symbols.

Requesting symbol

Robots and indicators can request a symbol specifying its symbol code. Symbol objects behave like the default Symbol object of a robot or indicator, containing current Ask, Bid, PipSize and other useful properties.

Symbol symbol = MarketData.GetSymbol("USDJPY");

Print("Symbol: {0}, Ask: {1}, Bid: {2}", symbol.Code, symbol.Ask, symbol.Bid);

Requesting OHLCV series

Robots and indicators can request OHLCV series for multiple symbols and timeframes and build indicators based on it.

MarketSeries series = MarketData.GetSeries("EURCAD", TimeFrame.Minute15);
MovingAverage ma = Indicators.SimpleMovingAverage(series.Close, 20);

Print("Symbol: {0}, TimeFrame: {1}", series.SymbolCode, series.TimeFrame);
Print("Last Close: {0}, Average Close: {1}", series.Close.LastValue, ma.Result.LastValue);

Trading multiple symbols

Robots in cAlgo can execute orders for different symbols. To do this, the robot must request the needed symbol by its code. Then, it will be possible to use it in a trade request:

 Symbol symbol = MarketData.GetSymbol("GBPCHF");
 ExecuteMarketOrder(TradeType.Buy, symbol, 10000);

The new version of our Demo cTrader and cAlgo is released and can be downloaded from www.spotware.com

Backtesting of Multi-symbol robots in not supported at least for now. It can be implemented in future.

Is it possible to access bid/ask as time series? i.e. bid[index]. I don't see t1 as option timeframe  MarketData.GetSeries("EURUSD", TimeFrame.t1), or is that something I would have to build myself?

Thanks

cTrader Team's avatar
cTrader Team since: 23 Sep 2013; 
 09 Sep 2015, 17:22

Dear Trader,

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

TRADERS FIRST™ Vote for your favorite features: http://vote.spotware.com/
Roni Zbaida's avatar
Roni Zbaida since: 01 Jan 2015; 
 28 Nov 2015, 19:11
RE: Multi-Symbol cBot OnTick() events

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?