Hello!

I want to use my script for analyzing multiple timeframes, 5 minutes to daily, all with 200 bars LookBack.
As I understand that the normal way to do that is something like this:

Code
BarPeriod = 5;
LookBack = 12*24*200;             // = 5 minutes * 12 * 24    (1 day)    *   200

TimeFrame = 1;
//...analyze the last 200 bars of M5...
TimeFrame = 3;
//...analyze the last 200 bars of M15...
TimeFrame = 12;
//...analyze the last 200 bars of H1...
TimeFrame = 12*4;
//..analyze the last 200 bars of H4...
TimeFrame = 12*24;
//..analyze the last 200 bars of D1...


My problem with this method is the unneccessarly huge amount of data loaded to RAM. Because with live trading (MT4 brigde) the script loads 12*24*200 bars of 5 minutes data per Asset to be able to calculate the Daily bars. But I just only need the last 200 bars for all of the TimeFrames, so basically 12*23*200 bars are useless at 5 minutes.

For larges timeframes, it could be much better and faster loading directly the larger bars, not calculate it by the smallers. Therefore I don't need to load 12*23*200 bars per asset, only 5*200.

Is there a way to do that?

Thank you!

Last edited by NorbertSz; 01/22/22 15:02.