Profile Picture

Evaluating RightEdge for use as a research platform, some questions...

Posted By dwalton 3 Years Ago

Evaluating RightEdge for use as a research platform, some questions......

QuestionMark Posted Friday April 15 2016
I'm an experienced system developer and programmer, having used many other trading platforms, I'm drawn to RE for its flexibility and extensibility. I have needs beyond a typical backtester / trader so RE seems like a good fit short of developing my own platform. I've been playing around with RE for a few days now and feel I have a decent grasp of the basics but there are several things I haven't come across in the forums or sample code that I'd like to ask about.

1) Is it possible to programmatically load historical data, modify it (e.g. return re-sampling) and then store it for trading system simulation? At a high level I want to create iterations of random market data using historical data as the base sample. I use this for stochastic modeling of expected trading system performance.Ideally I'd like to do this within an optimization plug-in for automation purposes as there will be 1000s of iterations.

2) Similar to #1, Is it possible to calculate historical volatility (or ATR) from a price series, and then modify the series to add a noise overlay as a multiple of historic volatility and use the new data as above?

3) I assume any position sizing method is possible (e.g. % volatility). Any example code available for something more complex than % margin position sizing?

4) I've seen references to the Paper Broker supporting partial fills. Any examples on this?

5) Is there a way to mark symbols as non-tradeable somehow? This is for the case where decisions are made based on some time series that is not a tradeable instrument.

6) I noticed that there is no way built-in to detect if the current bar is the last (symbol delisted) yet I see that Norgate has a plugin that provides this information. Any thoughts of adding this feature natively?
Posted Wednesday April 20 2016
I'll chip in with a few of these:

1. I haven't tried modifying the datastore from a RE system, but it should work I believe. My preferred way of doing these things is to generate the series outside. You could pre-generate series in a database or even have your data retrieval interface get random data every time you refresh. Just flush the series and grab new random data every time.

2. Do you want to modify the series data during a run? Seems like cutting off the branch that you're sitting on. Or do you just want to make a custom indicator? If you want to calculate a new custom indicator and push that data into your DB or datastore, that shouldn't be a problem.

3. Sure, you can calculate position sizing anyway you like. Here's an example which uses ATR sizing, but caps for historical peak vola.

// --opening position in NewBar
long numberOfContracts = positionSize(true);
// ----

private long positionSize(bool isLong) // Position size calculation, capping peak vola
double riskFactor;
if (isLong)
riskFactor = _longRiskFactor;
riskFactor = _shortRiskFactor;

double currentATR = _atr.Current;
double peakATR = _maxATR.Current * 0.8; // cap size at
double effectiveATR;

if (currentATR < (peakATR))
effectiveATR = (peakATR);
effectiveATR = currentATR;

if (_point_value==0.0) _point_value = 1;
long contracts =
(long)(Math.Max(1,SystemData.AccountValue * riskFactor /
(effectiveATR * _point_value * SystemData.AccountInfo.GetConversionRate(Symbol.CurrencyType,SystemData.AccountCurrency, QuoteType.Last).Value )));

return contracts;

4. I haven't tried that, but now that I think about it, I'm also interested in that.

5. Sure, depending on what you want to do. For instance, for my equity sims, I include any stock that has ever been a member of a specific index. Then I make a custom indicator which returns 1 if the stock was a member of a certain index on a given day, else 0. This indicator uses direct database calls. Now all I need to do is to add this 'indicator' to my system, and only allow trading if the indicator is 1. You could do the same on any factor you like.

6. I'm not aware of any native way to do this. I use a custom function that checks the last day through a direct database call, and stores this terminal date for each instrument. If we're on the last day, close at market. Yes, I do see a deficiency here, and if you don't handle this manually you risk getting stuck in a dead position forever.

Posted Wednesday April 20 2016
Thanks Andreas for chiming in! For #2 I'm trying to modify between simulation runs but automate it in an optimization plugin somehow.

Similar Topics

Reading This Topic

2005-2019 © RightEdge Systems