Hello cracks,
I know that calling reloadEFS() in main could create a loop
but I don´t understand in the lower example
why it does create a loop after pressing "reload"-button with the variable nLoop=4
but doesn´t create a loop with nLoop=1.
Please could anyone clarify?
I know that calling reloadEFS() in main could create a loop
but I don´t understand in the lower example
why it does create a loop after pressing "reload"-button with the variable nLoop=4
but doesn´t create a loop with nLoop=1.
Please could anyone clarify?
PHP Code:
function preMain() {
setPriceStudy(true);
setShowCursorLabel(false);
}
debugClear();
var nLoop = 0;
var bReload = false;
function main() {
trigger(); // sets bReload or not
if (bReload) {
bReload = false;
nLoop++;
debugPrintln(" Reloaded Chart , nLoop: "+nLoop);
if (nLoop==1 || nLoop==4) reloadEFS(); // !!!!!!!! works with nLoop==1 but not with nLoop==4
else { // Reload-Button
drawTextRelative(1, 15, " Reload @URL=EFS:reloadexec", null, null, Text.BUTTON |
Text.RELATIVETOLEFT | Text.RELATIVETOBOTTOM, null, 10, "Reload");
}
}
return close();
}
function trigger() {
var nState = getBarState();
var nIndex = getCurrentBarIndex();
if (nIndex == 0 && (nState == BARSTATE_NEWBAR || nState == BARSTATE_ALLBARS)) {
bReload = true;
}
return;
}
function reloadexec() { // Button execute
debugPrintln("*** Reload ***");
reloadEFS();
return;
}
Comment