[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 386
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
Probably something like this, because infinite loops take a very long time on modern hardware.
:)
Добрый день.
В индикатоте есть ф-я IndicatorShortName("iC_C_mod, ..... ");
Мне, однако, нужно, кроме этой надписи, - чтобя я могла вставить коммент с динамично изменяющейся переменной в окно индикатора.
Типа ф-и Comment();
Но только, именно, в окно индикатора, а вовсе не на сам график.
Пож. подскажите ?
so it will output to the window you want
Добрый день.
В индикатоте есть ф-я IndicatorShortName("iC_C_mod, ..... ");
Мне, однако, нужно, кроме этой надписи, - чтобя я могла вставить коммент с динамично изменяющейся переменной в окно индикатора.
Типа ф-и Comment();
Но только, именно, в окно индикатора, а вовсе не на сам график.
Пож. подскажите ?
You can create a label and change the text
The code may be wrong, but it works.It will be interesting to listen to you on the following question:
There is an opinion that the quotation of a currency pair is influenced by many other financial instruments:
movement of leading stock indices, futures, options, etc.
1) Do you think it is possible to trace this influence
(and therefore constructively used in a trading strategy)???
2) Have you noticed any persistent correlations between the relevant currency pairs and the quotes of other financial instruments?
3) Have you used indicators to demonstrate such correlations?
(I'm waiting for your comments in the thematic branch of this forum with the same name: https://forum.mql4.com/ru/28930 )
splxgf писал
void CheckSell()
{
if((NormalizeDouble(Price,Digits) < NormalizeDouble(MA10,Digits)))
Sell();
}
But then the program will just check the condition and if it is fulfilled, it will sell it. And if it doesn't, what will it do? It is supposed to wait for the condition to be fulfilled in this very code fragment.
Vinin wrote
Why did you make a loop? If there is no condition, the program should just exit and not wait for the signal to appear.
That is why I made the loop, because it is in this code fragment where the program should wait for the condition to appear. You cannot exit to the beginning of the loop. What is the correct way to implement the wait for a condition?
And this is my design:
void CheckSell()
{
while(!(NormalizeDouble(Price,Digits) < NormalizeDouble(MA10,Digits)))
{
Sleep(5);
RefreshRates();
}
Sell();
}
- Is it working and just hangs the tester? Or it does not work at all? Very much want to understand how to properly wait for a condition to be fulfilled without exiting the given function.
Thanks for the answers!
Но ведь тогда программа просто проверит условие и если оно выполняется, продаст. А если не выполняется, что она будет делать? По задумке, должна ждать выполнения условия именно в этом месте кода.
Вот поэтому и сделал цикл, что именно в этом месте кода программа должна ждать выполнения условия. Выйти в начало нельзя. Как правильно реализовать цикл ожидания условия?
- она рабочая и просто тестер вешает? Или не работает в принципе? Очень хочется понять, как правильно ожидать выполнения условия, не выходя из заданной функции.
The program is most likely to work, and it is wrong to wait for the condition without exiting the function, at least the tester will not give a new tick until the procedure has been executed.
If the condition is not fulfilled, you should terminate the program and give control to the tester. Programs used to be linear and therefore looped themselves and waited for signals from above. Now the program is event-driven, when event occurs, for example, a new tick and the handler of this event is call start() after all necessary work on processing of a new tick is finished, the function must terminate, instead of being a dispatcher.
It is correct to check the condition in the start(), the condition has come, do your business, if not, finish your work and wait for the next tick. We already adjust our logic to this.
There is also a question.
The indicator displays the MA lines of two currency pairs in a separate window. It works fine.
But when I insert a condition in the code:
"If on one of the symbols a bar is missed, then on the second symbol - this present bar is skipped (not considered)", like this:
Then mt4 hangs for a minute and a half to two minutes. Then the indicator starts working, but it uses 35-45% of RAM.
What can be the reason, please advise?
Good afternoon!
Can you please tell me how to write a simple indicator that would highlight a certain bar (should be set in the options), for example at 12.30 with a vertical line and sign the days of the week on the chart (say somewhere above the hay of each day)?
Thank you!