- How To Ask Questions The Smart Way. (2004)
Be precise and informative about your problemNo idea what datatype your TempValue or bid is.
No idea what value your bid is, or when you update it.
-
for(int i = 0; i < ObjectsTotal(0, 0, -1) ; i++){ string ObjectNameTemp = ObjectName(0, i, -1, -1);
You are getting the object count for the current chart, main window, but selecting object i on the current chart, including all sub-windows. Code fails if there are sub-windows with any objects.
-
There is no need to supply default parameters. Write self-documenting code. Simplify your code:
#define WINDOW_MAIN 0 for(int i = 0; i < ObjectsTotal(0, WINDOW_MAIN) ; i++){ string ObjectNameTemp = ObjectName(0, i, WINDOW_MAIN);
thanks for the tip, william roeder! the variable is a double type, thought that was clear, sorry. you're right about the main window, i was able to refine my code with it, so that's good to know. but the problem seemed to be something else: my program is very large in terms of the number of lines and there is a lot in the onTick() function. I've moved the loop higher up now, at the beginning of onTick(). Now he calls it constantly and the code ALWAYS works..
I will ask my questions more precisely next time and give more information.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello, I have a simple code here.. it usually opens positions. but sometimes he doesn't and i don't know why. as soon as the bid is above the line, he should actually always trade.. please help.
the variable passed to the SELL function is the stoploss. the price and stoploss are always displayed correctly, i can see them on the chart (on the lines)