Announcement

Collapse
No announcement yet.

Market closed...does indicator still calculate

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

  • Market closed...does indicator still calculate

    Hello,

    When the market is closed for the instrument, does the indicator still calculate? I am debugprint for the today.minute and nothing is printing.

    I am doing this for testing...

    -Manesh

  • #2
    Manesh,

    If your print statement is in a CURRENTBAR statement like below, then it won't print until there's data streaming in.

    if(getBarState() == BARSTATE_CURRENTBAR){
    debugPrintln("Anything");
    }

    Other than that, if your print statement is inside a block of code like an "if" statement that doesn't evaluate to true and you don't have an "else" statement with the print statement in it, then it's not going to print. In that case, put a copy of your debugPrintln statement in the else statement with some extra text that tells you that it's printing from the else statement. This would tell you that you have a logic problem in the event that you think that it should be printing from the "if" statement.

    LetUsLearn

    Comment


    • #3
      Hello,

      I have the following in the main section. Nothing else.

      if (1==2)
      debugPrintln("test1")
      else
      debugPrintln("test2")


      If not printing anything now. I guess it is because markets are closed. I want it to print something when markets care closed so I can use time.

      Comment


      • #4
        Manesh,

        It prints "test2" for me for each and every bar that loads. Has this code been saved and loaded into a chart? If so, the status line on the top left of the chart should show your program's name unless you have the the "Show Study Titles" checkbox unchecked in the "Chart Properties" dialog box. If you can see your study's title, right-click on it and open the code in the script editor and verify that your code is as shown in your post.

        If you change some code on a program, you have to reload the program for it to be active on the chart. When you reload the code you indicated in your post, it should print "test2" in the "Formula Output" window for every bar that's loaded, that's what the code below did for me.

        function main() {
        if(1==2) debugPrintln("test1");
        else debugPrintln("test2");
        return;
        }

        LetUsLearn

        Comment

        Working...
        X