Announcement

Collapse
No announcement yet.

for loop questions and basic questions how function main() work?

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

  • for loop questions and basic questions how function main() work?

    I have 3 "For loops" in my program under function main() using a one minute chart. I am trying to figure out how the program reads in function main()? Is it sequential from top to bottom until it reads "return"? Does it read all the data first and then work the formulas in the program or does it read one piece of stock data and then goes through the formulas?

    Is the "return" statement at the end of the program in the correct place? When it reads "return" does it go back to the beginning of function main() and gets the next one minute data point and then goes through the formulas again repeating itself until all the one minute data analyzed?

    I also ran it once and got an "Out of Memory" message. Looked everywhere and could find no information on this. Any suggestions as to where I can find info on this? I realize it most likely is due to an error on part writing the program.

    PHP Code:
    function main() {
        for (var 
    iii 0iii 16iii++) {
            for (var 
    jjj 0jjj 16jjj++) {
                for (var 
    kkk 50kkk 92kkk kkk 2) {
                        
                    var 
    ibarMinute getMinute(0);
                    var 
    ibarHour getHour(0);
                    var 
    ibarDay getDay(0);
                    var 
    ibarMonth getMonth(0);
                    var 
    ibarYear getYear(0);

                    if(
    ibarHour == 10 && ibarMinute == 31) {
                         
    //My code goes here 
                    
    }

                     if (
    ibarHour == 15 && ibarMinute == 59) {
                           
    //My code goes here
                     
    }
     
                }
            return;
            }
        }

    or should the last 5 lines of the program look like this?

    PHP Code:
                 }
            }
        }
    return;

    Or should the top part of the program be switched around like this?

    PHP Code:
    function main() {
    var 
    ibarMinute getMinute(0);
    var 
    ibarHour getHour(0);
    var 
    ibarDay getDay(0);
    var 
    ibarMonth getMonth(0);
    var 
    ibarYear getYear(0);

    for (var 
    iii 0iii 16iii++) {
        for (var 
    jjj 0jjj 16jjj++) {
            for (var 
    kkk 50kkk 92kkk kkk 2) {

            
    //My code goes here

            
    }
        }
    }
    return;


  • #2
    OK, I figured it out, no help needed. I placed the for loops in the wrong areas. Please disregard this post.

    But if anyone can give me info about "Out of Memory" error message, that would be appreciated. Is there a place that describes or lists all the error messages?

    Comment

    Working...
    X