How to get the last n bars on the chart

Hi. I would like to know how i can get the last 20 bars on the chart. Do i need to use iBars? I appreciate it if you give me an example

Shall I use some iBarShift or ?

This is what your loop should look like:

int bars = iBars(_Symbol, PERIOD_CURRENT);
   for (int i=0; i<bars && i<20; i++) {

thank you very much :slight_smile: