Multi-symbol robots and indicators

22 Jan 2015, 23:19Multi-symbol robots and indicators#21
Denis posts: 155since: 04 Feb 2014

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
06 Feb 2015, 15:55#22
Denis posts: 155since: 04 Feb 2014

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
10 Feb 2015, 10:44RE:#23
Spotware Teamposts: 3344since: 23 Sep 2013

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/
13 Feb 2015, 02:03#24
Denis posts: 155since: 04 Feb 2014

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
24 May 2015, 00:58#25
inferno285posts: 1since: 24 May 2015

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

12 Jun 2015, 17:59RE:#26
Spotware Teamposts: 3344since: 23 Sep 2013

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/
06 Sep 2015, 02:16RE:#27
Roni Zbaidaposts: 32since: 01 Jan 2015

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

06 Sep 2015, 02:16RE:#28
Roni Zbaidaposts: 32since: 01 Jan 2015

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

09 Sep 2015, 17:22#29
Spotware Teamposts: 3344since: 23 Sep 2013

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/
28 Nov 2015, 19:11RE: Multi-Symbol cBot OnTick() events#30
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?