Short Name: While
Definition: Signal the beginning of a “While” construction
Usage: While(test).... Action .... EndWhile
Objective:
- Part of a “While” construction
- Run the loop while Test returns YES
- Action can be any complex set of instructions, including other If, For or While constructions
- It is pretty easy to run into an endless loop, Mastock includes a safe guard guaranteeing the loop finishes
Note:
- Does not return anything
Examples:
- Playing Around:
- varRSI = RSI(14)
- index = 0
- while(index < 2)
- if(index == 0) then
- for(0,10)
- valeur = var(varRSI,0)
- accumulate(premier,valeur)
- endfor
- logresult(stddev(premier))
- notifyresult
- else
- avg20 = avg(20)
- avg50 = avg(50)
- buy = crossabove(avg20,avg50)
- sell = crossbelow(avg20,avg50)
- notifyresult(buy,sell)
- endif
- increment(index,1)
- endwhile
- logresult(it works...)