Announcement

Collapse
No announcement yet.

Setting Variable Once Each Day

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

  • Setting Variable Once Each Day

    What's the best way to set a variable once each day?

    I thought I could use a different variable to check - i.e., if check variable = 0 then statement and check = 1 - but (at least on the chart I was looking at) this only worked once (it didn't reset each day). Do variables initialized in between premain and main reset each day for backtesting purposes?

    Thanks.

  • #2
    Hi,

    Checking the day may be the best way to do this. As in:

    var LastDay = null;

    CurrentDay = getDay();
    if (CurrentDay != LastDay){
    Do Lots of stuff
    }
    LastDay = CurrentDay;


    Variable declared outside of main() and PreMain() don't get reinitialized.
    Garth

    Comment

    Working...
    X