You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
What speculation?
if you declare a variable in a function it will only be local to that function.
if you declare it before init() it can be accessed in all functions and will keep its value in between program runs.
I dont use any void, int or other types of secondary functions only the start(), it wont work for start neither because i have bunch of variables in init and they work fine?
Even before i was trying to implement this moving average strategy they worked fine.Actually they were not declared in the init they were declared outside any function only set their values in the init :D
Ok i resolved the issue, it was hard work.The solution is the following:
An auxiliary variable to which would have the same values as STATUS variable but would be overwritten earlier
And a BUYALLOW and SELLALLOW boolean
and set the
SALLOW=false;
after putting the sell order and the
after putting the buy
I dont use any void, int or other types of secondary functions only the start(), it wont work for start neither because i have bunch of variables in init and they work fine?
Even before i was trying to implement this moving average strategy they worked fine.Actually they were not declared in the init they were declared outside any function only set their values in the init :D
"Actually they were not declared in the init they were declared outside any function only set their values in the init :D"
Isn't that exactly what I have been saying in all my posts in this thread??
if you want local variables to retain their values make them static. You could have used static bool flags in the start() function.