Perhaps you should read the manual. OnTick is called for each new tick, so it will "be repeated automatically." There isn't a way to not "do it."
Perhaps you should read the manual. OnTick is called for each new tick, so it will "be repeated automatically." There isn't a way to not "do it."
OnTick() return this error when i use it ouside the void type : 'OnTick' - expression of 'void' type is illegal in the manual it is said that It must be declared as the void type, with no parameters:
so how can i use it ???
void OnTick() {
You already "declared as the void type, with no parameters." You do not call it, the terminal calls it.
You already "declared as the void type, with no parameters." You do not call it, the terminal calls it.
Ok i know the terminal already called it but it does not repeat the task when the task is done when i start the program it goes one time then when it is finish it does not repeat even with the void OnClick() so i do not understand what you try to tell me !! i tried while loop around the source code it does not work can you be more specific thanks.
There is no such function OnClick().
Stop adding code! The problem is not the code.
OnTick() is call when there is a new tick. That is what I tried to tell you. Nothing more.
Are you connected to a broker? Is there a smiley face?
I'm actually connected to broker account on the top rigth corner of my chart the name of my EA (TEST88) is there i do not see the Smiley face. Did i forgot to do something to see the smiley face??
here is a picture:
Because you are running Linux and do not have the windows font with the smiley face installed.
The EA is loaded on your chart.
A dirty way to restart an EA is by calling OnInit() function, But it is not in your code...
Your problem is your "Count" variable.
The terminal is
connected and receives ticks, and they trigger OnTick (), but every time
this function is called, you add 1 to the value of the Count variable,
therefore, that variable will only have a value = 1 the first time OnTick() is called.
The
value of this variable will increase (the next time will be 2, then 3,
4, 5, 6 .... etc), and therefore the rest of functions are NOT executed
since one of the conditions for them to be executed is which Count == 1.
Why if Count == 1 ???
void OnTick() { int PositionIndex; int TotalNumberOfOrders; slippage=10; volume=0.01; Count++; if(Count==1 ) { ............................ } while(true&&Count==1&&ticket1>1&&ticket2>1){ TotalNumberOfOrders=OrdersTotal(); ........................... }
Your problem is your "Count" variable.
The terminal is
connected and receives ticks, and they trigger OnTick (), but every time
this function is called, you add 1 to the value of the Count variable,
therefore, that variable will only have a value = 1 the first time OnTick() is called.
The
value of this variable will increase (the next time will be 2, then 3,
4, 5, 6 .... etc), and therefore the rest of functions are NOT executed
since one of the conditions for them to be executed is which Count == 1.
Why if Count == 1 ???
I removed the Count variable after i tried it without doing Count==1 but just Count and still does not repeat the task it does it once a nothing after that i dont understand what is the problem if i got the function OnClick() why it does not repeat the task ????
Because you are running Linux and do not have the windows font with the smiley face installed.
The EA is loaded on your chart.
A dirty way to restart an EA is by calling OnInit() function, But it is not in your code...
it is not working !!
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Below is my source code when the task is done i want it to be repeated automaticly i cant find the way to do it any help will be apreciated.