how can I overcome inefficient trader backtesting

Created at 25 Sep 2021, 22:06
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
CT

ctid386599

Joined 26.03.2018

how can I overcome inefficient trader backtesting
25 Sep 2021, 22:06


hi,

im trading daily bars which looks very profitable but im told its inaccurate. m1 is slow and ticks data which is fast is impossible  to back test. extremely slow. also limited length of data.

 

is there a away to load only ticks which are say 1m away from end of day instead of all ticks of the day that I don't need. that way, I can load year of ticks without running out of memory because only a few minutes of ticks data are loaded per day.

thank in advance


@ctid386599
Replies

PanagiotisCharalampous
27 Sep 2021, 08:04

Hi ctid386599,

To give more specific advice, we need to know the strategy you are backtesing. Accuracy depends on the way your strategy works. If you can share your source code, we can provide suggestions.

Best Regards,

Panagiotis 

Join us on Telegram and Facebook


@PanagiotisCharalampous

ctid386599
27 Sep 2021, 13:25

RE:

PanagiotisCharalampous said:

Hi ctid386599,

To give more specific advice, we need to know the strategy you are backtesing. Accuracy depends on the way your strategy works. If you can share your source code, we can provide suggestions.

Best Regards,

Panagiotis 

Join us on Telegram and Facebook

Thank you for reply. Its not about strategy. Its more the fact that its impossible to back test on  ticks data for months even  if the strategy just open  buy on every daily candle because it will take forever to load data every tick. can it load a few ticks to end of day, month etc?


@ctid386599

PanagiotisCharalampous
27 Sep 2021, 13:28

Hi ctid386599,

If the strategy operates in OnBar and uses only bar data then in principle you should be able to use bar data instead of tick data without a problem.

Best Regards,

Panagiotis 

Join us on Telegram and Facebook


@PanagiotisCharalampous

ctid386599
27 Sep 2021, 14:08 ( Updated at: 27 Sep 2021, 14:20 )

RE:

I just need the last close value

Bars = MarketData.GetBars(TimeFrame.Daily, symbol.Name);

close = Bars.ClosePrices.Last(index);

will  loading the  Timefrme.Dily be as accurate as Timeframe.Minute? or should I use Symbol.Bid/Ask for accurate close value?

I use try and catch because sometimes

the  currency pairs dont load or cant be found

 

sorry for 2nd question. i need multiple currency pairs and i load them like this:

public Symbol[] MySymbols;
protected override void OnStart()
{
            MySymbols = Symbols.GetSymbols("EURGBP", "EURAUD",  "EURUSD", "EURCAD", "EURCHF", "EURNZD", "EURJPY", "GBPAUD", "GBPUSD", "GBPCAD", "GBPCHF", "GBPNZD", "GBPJPY", "AUDUSD", "AUDCAD", "AUDCHF", "AUDNZD", "AUDJPY", "NZDUSD", "NZDCAD", "NZDCHF", "NZDJPY", "USDCAD", "USDCHF", "USDJPY", "CADCHF", "CADJPY", "CHFJPY");
}
 protected override void OnBar()
  {

            foreach (var symbol in MySymbols)
            {
                    try
                    {
                        string name = symbol.Name;
                        //catch (Exception ex)
                    } catch (Exception)
                    {
                        continue;
                    }

                   Bars = MarketData.GetBars(TimeFrame.Daily, symbol.Name);
                   //Bars = MarketData.GetBars(TimeFrame.Minute, symbol.Name);
                    for (int index = 1; index < TheseBars.Count; index++)
                    {
                        Close = TheseBars.OpenPrices.Last(index);
                        if(close!==Null)
                             break;
                    }
             }

}

PROBLEM: I think every bar i load a list of bars for all the 28 currencies which is to heavy. can i load the bars once and just use  index to access the latest bar?

Thank you

 

 

PanagiotisCharalampous said:

Hi ctid386599,

If the strategy operates in OnBar and uses only bar data then in principle you should be able to use bar data instead of tick data without a problem.

Best Regards,

Panagiotis 

Join us on Telegram and Facebook

 


@ctid386599

PanagiotisCharalampous
27 Sep 2021, 14:14

Hi ctid386599,

I don't understand what do you mean when you say "as accurate as". There is only one closing value for a bar and it is correct.

Regarding the code you posted, I don't really understand it's purpose.

Best Regards,

Panagiotis 

Join us on Telegram and Facebook


@PanagiotisCharalampous

ctid386599
27 Sep 2021, 15:41

RE:

I didn't send the main part of cords to avoid confusion. all I need is to take  the close values of about  20-28 major currency pairs and  do some math on them before deciding which ones are  bearish and which ones are bullish. I  needle the close values in a list

 

PanagiotisCharalampous said:

Hi ctid386599,

I don't understand what do you mean when you say "as accurate as". There is only one closing value for a bar and it is correct.

Regarding the code you posted, I don't really understand it's purpose.

Best Regards,

Panagiotis 

Join us on Telegram and Facebook

 


@ctid386599