How to stop current execution

 
when a code runs the journal continues to log even after end of test run, please teach me how to stop it after end of exection, thanks.
 

wat is code?

1. Expert Advisor

2. Script

3. Indicator

.

If 1 or 3, once attached to chart, they run UNTIL u stop program. Each new data tick terminal gets from server, it 're-enter' your code at start() and so it runs again,...

If 2, once attached to chart, it runs ONCE and then stops. Unless code has eg, forever loop... then it run forever ;)

If 1 or 3, u can have flag in code to stop code in start() running - but as said above, will get called again,again... eg:

.

//if declare flag variable outside all functions:

bool testRunDone = false;

.

//in start() function, at very top as first instruction line to be executed:

if(testRunDone) return(0); //1st time start() 'code body' runs because flag is false; 2nd plus times start() exit 'here/this instruction' as u set flag true on next line (but... code does ur ONE test run b4 exit on 1st start() entry)

testRunDone = true;

...

rest of code and only done ONCE bcuz flag now set true and 'next' start() entry the if(..) instruction cause exit so all this stuff not execute ever again ;)

...

return(0);

.

fwiw

 

Presently I am doing codes to understand the reaction of codes, for this, if new data were to come in and disturb, it is unwanted, please suggest what mode I should use for history testing purpose,

Thanks.

 

"when a code runs the journal continues to log even after end of test run"

maybe i not get it first time.

journal logging after tester run is not abnormal afaik, u have code + tester = fast; maybe code blast out prints + maybe terminal do same + tester maybe do same = slow cuz print takes time = issue gui cmd to print + display on screen time + scroll screen time +?

same issue get if run .exe, cpu run faster - screen run slower = .exe done but screen still scrolling out data.

.

if i still 'not get it' then all can say is that u can stop disturb as i already say - use flag in EA or Ind.

this is once only action - code attached to chart -> flag tested = false -> set flag true -> do code -> return(0) -> code reentered -> flag tested = true -> return(0) AND never code done again below flag tested line.

.

if i still 'not get it' maybe it is u want no disturb BUT only for certain time window or watever, then u want code be disturb again. well... EA or Ind not have to exit/return(0) UNTIL u want it to.

so code not disturb cuz it never exit back to Terminal = code stays in code...

i never do that in tester - tester is strange thing, like it ignore Sleep() and other calls.

.

if i still 'not get it' maybe someone else understand wat going on with this thread - i finished now - no any more ideas

.

Best

Reason: