Announcement

Collapse
No announcement yet.

how to filter any given day?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • how to filter any given day?

    Hello,

    i'm tryng to filter an specific day (actually more than one) from a chart to do my backtesting wich means that i want to ignore ( not consider) these days of the total number of days. for instance:
    i want to backtest an strategy in 60 days chart (es #f,5)60 Days, here is my "problem" this time frame includes the days that i want to exclude (11/28/, 11/29, 12/24 and so on).

    Q: How can i get the same chart ( es #f, 5) 60 Days WITHOUT these days, or maybe WITH these days BUT not being part of the strategy.
    Can be done this with template, efs formula etc?



    Looking forward for feedback

  • #2
    Filtering Days...

    You would have to filter them internally.... Meaning, you would have to calculate the bar's date and write the code to exclued the days.... Here is an example...

    Place this code at the beginning of your MAIN function...

    var vTime = new Date();
    vTime = getValue("Time", 0);
    var vHour;
    var vMin;
    var vSec;
    var vDay;
    var vMonth;
    // Get Time Variables
    vHour = vTime.getHours();
    vMin = vTime.getMinutes();
    vSec = vTime.getSeconds();
    vDay = vTime.getDate();
    vMonth = vTime.getMonth() +1;

    This code gets the current BAR time...

    Now, you would filter your entry code with an "if" statement like this....

    if ((vMonth != 12) && (vDay >=23) && (vDay <=31)) {

    Trade your heart out....

    }

    Hope this helps...

    Brad
    Brad Matheny
    eSignal Solution Provider since 2000

    Comment


    • #3
      Hello Brad,

      i appreciate a lot your code, i will test it during the day, i hope that work as well.

      Juano

      Comment


      • #4
        Thank you very much Brad

        The code worked nicely !!

        Appreciate your help

        Juano

        Comment

        Working...
        X