Strategy testing with Candles from csv file
Atom
24.04.2017
Shubha


We want to perform strategy backtesting on history data stored in txt file. As we understand from the samples, the txt file should be converted to S# format before we can run strategy and testing on them. Please update if this understanding is correct.

We need sample code how we can covert txt file to S# format through code. What are the classes we should look at?

Or alternatively, can we run strategy on history data stored in txt file directly? Please share sample code if this is possible.

Regards
Shubha

Теги:


Спасибо:


1 2  >
Support

Фотография
Дата: 25.04.2017
Ответить


Send an example of your txt file.
Спасибо:

Shubha

Фотография
Дата: 25.04.2017
Ответить


Hello,

Attaching txt file where the history data is stored. Data is stored in the format date, time, O, H, L, C and Volume values separated by comma.

Thank you.
ACCN.txt 457 KB (547)
Спасибо:

Support

Фотография
Дата: 26.04.2017
Ответить


Ok, we will prepare an example for you.
Спасибо:

Shubha

Фотография
Дата: 27.04.2017
Ответить


Hello! Looking forward for the example code as mentioned above, it will be really helpful.

Thank you.
Спасибо:

Support

Фотография
Дата: 28.04.2017
Ответить


The optimal solution is to convert your data into the s# candle format of the store. An example of a converter is attached.
CandleConverter.7z 115 KB (554)
Спасибо:

Shubha

Фотография
Дата: 03.05.2017
Ответить


Thank you for the code. We have multiple files where the 5 minute candle data is stored for each stock on the exchange. Please recommend the best approach for running strategy on these files.

One solution is to convert all of these data to S# bin format as you have specified above. Please let me know if there are other approaches we can consider.

Thank you,
Спасибо:

Support

Фотография
Дата: 03.05.2017
Ответить


Ok.
Спасибо:

Shubha

Фотография
Дата: 10.05.2017
Ответить


Hello,

I am trying to run a simple SMA strategy on the converted candles using HistoryEmulationConnector on the Data folder. I am specifially using the sample code in the Lesson Video 8 - TestingAndTrading sample.

The sample works fine and shows the PnL curve when using the sample code and sample data provided with the examples.

string path = Path.GetFullPath(@"..\..\..\..\History\");
((LocalMarketDataDrive)storage.DefaultDrive).Path = path;

// создаем инструмент для тестирования
_security = new Security
{
Id = "RIM5@FORTS",
Code = "RIM5",
Name = "RTS-6.15",
PriceStep = 10,
StepPrice = 2,
Board = ExchangeBoard.Forts
};

When I change the code to point to the converted candles data folder, it does not work.

string path = Path.GetFullPath(@"..\..\..\..\History\");
string path = Path.GetFullPath(@"C:\Data\NETProjects\StockSharp\ExampleStrategy\CandleConverter\bin");

*_security = new Security
{
Id = "ACCN@NYSE",
Code = "ACCN",
Name = "ACCN",
PriceStep = 10,
StepPrice = 2,
Board = ExchangeBoard.Nyse
};

The strategy just does not execute. It does not hit the code for Onstarted of strategy and ProcessCandle.

Please advise what is missing in the data that is converted.

Thank you!
Спасибо:

Shubha

Фотография
Дата: 10.05.2017
Ответить


Hello,

I am trying to run a simple SMA strategy on the converted candles using HistoryEmulationConnector on the Data folder. I am specifially using the sample code in the Lesson Video 8 - TestingAndTrading sample.

The sample works fine and shows the PnL curve when using the sample code and sample data provided with the examples.

string path = Path.GetFullPath(@"..\..\..\..\History\");
((LocalMarketDataDrive)storage.DefaultDrive).Path = path;

// создаем инструмент для тестирования
_security = new Security
{
Id = "RIM5@FORTS",
Code = "RIM5",
Name = "RTS-6.15",
PriceStep = 10,
StepPrice = 2,
Board = ExchangeBoard.Forts
};

When I change the code to point to the converted candles data folder, it does not work.

string path = Path.GetFullPath(@"..\..\..\..\History\");
string path = Path.GetFullPath(@"C:\Data\NETProjects\StockSharp\ExampleStrategy\CandleConverter\bin");

*_security = new Security
{
Id = "ACCN@NYSE",
Code = "ACCN",
Name = "ACCN",
PriceStep = 10,
StepPrice = 2,
Board = ExchangeBoard.Nyse
};

The strategy just does not execute. It does not hit the code for Onstarted of strategy and ProcessCandle.

Please advise what is missing in the data that is converted.

Thank you!
Спасибо:

Shubha

Фотография
Дата: 10.05.2017
Ответить


Hello,

Also, when I try to create a candle chart with the above data containing ACCN@NYSE folder, it does not create any candles. I am using SampleChart sample from Samples/Chart/Sample example that comes with the SDK. It is not able to plot the chart when I point the folder to the right folder and update the security details.

I am not sure why the data is not being read to create a chart. Maybe this is the reason why strategy is not run. Because it is not able to read the candles. Please let me know what am I missing.

Thank you.
SampleChart.png 133 KB (489)
Спасибо:
1 2  >

Добавить файлы через драг-н-дроп, , или вставить из буфера обмена.

loading
clippy