Announcement

Collapse
No announcement yet.

series trigger re-run of Main() ??

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

  • series trigger re-run of Main() ??

    Hi,

    Does calling the following function - lowest(5,low()) - inside function Main() triggers the Main() to be called for every each and every historical bar?

    And if I have the following two lines inside the Main(),

    lp = lowest(5,low());
    hp = highest(5,high());

    Will the Main() be called twice for each and every historical bar?

    Is it true that for every series function I call, like the one above, the Main() is called for each and every historical bar? If so, how can I avoid that?

    Thank you.

    William

  • #2
    William
    main() is called once on each historical bar [as the script is loading] regardless of the functions being used in it.
    Alex

    Comment


    • #3
      Alex,

      Is it true that when Internalefs or Externalefs is called, the main() is called for each historical bar?

      William

      Comment


      • #4
        William
        As I indicated in my previous reply main() is called once on each historical bar regardless.
        You can easily see this using a debugPrintln() statement. Try adding the code enclosed below to your script or just running it as is and you will see that main() is executed once per bar as the script runs through historical bars
        Alex

        PHP Code:
        debugClear();

        function 
        main(){

            
        //your code here

            
        debugPrintln("Bar Index "+getCurrentBarIndex());

            
        //your return

        Comment

        Working...
        X