offset +1

Posted By: Grat

offset +1 - 06/20/19 13:04

Hi,

how to call any FCE every 6-th minute?

Code
void run(){
  LookBack = 0;

  BarPeriod = 1;
  FrameOffset = 1;
  TimeFrame = 5;  
  if (frame(0))
    printf("\nframe%d   %s:%f",i,datetime(),second());

}



this no work
Posted By: Grat

Re: offset +1 - 06/20/19 13:22

I have a small problem with FrameOffset
Code
string datetime()
  {
    return strf("%04d-%02d-%02d %02d:%02d",
      year(),month(),day(),hour(),minute());
  }
//--
void run(){
  LookBack = 0;
  set(STEPWISE|LOGFILE);

  BarPeriod = 1;
  FrameOffset = -1;
  TimeFrame = 5;  
  if (frame(0))
    printf("\nframe%d   %s:%f",i,datetime(),second());

}


with FrameOffset = -1;
Quote

[1: Thu 14-01-02 05:00] (1.37452)
Error 047: No bars to plot!
[2: Thu 14-01-02 05:01] (1.37448)
[3: Thu 14-01-02 05:02] (1.37472)
[4: Thu 14-01-02 05:03] (1.37461)
frame0 2014-01-02 05:03:0.000559 << offset -2
[5: Thu 14-01-02 05:04] (1.37468)
[6: Thu 14-01-02 05:05] (1.37476)
[7: Thu 14-01-02 05:06] (1.37475)
[8: Thu 14-01-02 05:07] (1.37470)
[9: Thu 14-01-02 05:08] (1.37468)
frame0 2014-01-02 05:08:0.000558 << offset -2
[10: Thu 14-01-02 05:09] (1.37472)
[11: Thu 14-01-02 05:10] (1.37474)
[12: Thu 14-01-02 05:11] (1.37472)
[13: Thu 14-01-02 05:13] (1.37473)
[14: Thu 14-01-02 05:14] (1.37472)
frame0 2014-01-02 05:14:0.000558 << offset -1
[15: Thu 14-01-02 05:15] (1.37474)
[16: Thu 14-01-02 05:16] (1.37472)
[17: Thu 14-01-02 05:17] (1.37473)
[18: Thu 14-01-02 05:18] (1.37472)
[19: Thu 14-01-02 05:19] (1.37473)
frame0 2014-01-02 05:19:0.000559 << offset -1
[20: Thu 14-01-02 05:21] (1.37472)
[21: Thu 14-01-02 05:22] (1.37472)
[22: Thu 14-01-02 05:23] (1.37477)
[23: Thu 14-01-02 05:24] (1.37479)
[24: Thu 14-01-02 05:25] (1.37478)
frame0 2014-01-02 05:25:0.000559 << offset 0 !!!
[25: Thu 14-01-02 05:26] (1.37478)
[26: Thu 14-01-02 05:27] (1.37476)
[27: Thu 14-01-02 05:28] (1.37478)


with FrameOffset=1
Quote

[4: Thu 14-01-02 05:03] (1.37461)
[5: Thu 14-01-02 05:04] (1.37468)
[6: Thu 14-01-02 05:05] (1.37476)
frame0 2014-01-02 05:05:0.000558 << offset 0
[7: Thu 14-01-02 05:06] (1.37475)
[8: Thu 14-01-02 05:07] (1.37470)
[9: Thu 14-01-02 05:08] (1.37468)
[10: Thu 14-01-02 05:09] (1.37472)
[11: Thu 14-01-02 05:10] (1.37474)
frame0 2014-01-02 05:10:0.000559 << offset 0
[12: Thu 14-01-02 05:11] (1.37472)
[13: Thu 14-01-02 05:13] (1.37473)
[11: Thu 14-01-02 05:10] (1.37474)
frame0 2014-01-02 05:10:0.000559 << offset 0
[12: Thu 14-01-02 05:11] (1.37472)
[13: Thu 14-01-02 05:13] (1.37473)
[14: Thu 14-01-02 05:14] (1.37472)
[15: Thu 14-01-02 05:15] (1.37474)
[16: Thu 14-01-02 05:16] (1.37472)
frame0 2014-01-02 05:16:0.000559 << offset 1 !!!
[17: Thu 14-01-02 05:17] (1.37473)
[18: Thu 14-01-02 05:18] (1.37472)
[19: Thu 14-01-02 05:19] (1.37473)



my question is, howto call FCE every 6-th minute?

note:
I trying find the system solution, not like this
Code
int n=minute();
if (n == 6 || n == 12 || n == 18 ....
Posted By: Spirit

Re: offset +1 - 06/21/19 06:22

Your timeframe selects every 5th bar, not evry 6th minute.

For every 6th minute, i would use if(minute() % 6 == 0).
© 2024 lite-C Forums