Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 298

 
Vitaly Muzichenko:

By code.

Make simply return if volume is low, i.e. interrupt further code execution


I need condition, option in settings, if you choose true: at [1] candle with increasing volume a trade is opened only, and I want to know how to correctly write it in robot with brackets. I.e. the whole bool or whatever is needed in the beginning)


As for the screenshot - so it seemed more visible to me))

 
Tigerfreerun:

I need a condition, an option in the settings, if you choose true: when a candle [1] with increasing volume opens a trade only, and I would like to understand how to correctly enter it into the robot with brackets. I.e. the whole bool or whatever is needed in the beginning)


And what about the screenshot - I think I see it better))

Right?

extern bool AllowVolume = true;

void OnTick()
 {

 if(AllowVolume && Volume[2] > Volume[1]) return;
 // код открытия

 }
 
Vitaly Muzichenko:

Is that right?


Yes, thank you. In case you write it at the beginning of the EA, anything further will be blocked, including graphical displays, right? Or once run - the mapping will work further?

 
Tigerfreerun:

Yes, thank you. In case you write it at the beginning of the EA, anything further will be blocked, including graphical displays, right? Or once run - the mapping will work further?

Move the opening code to the very bottom and block it

 
Vitaly Muzichenko:

Move the opening code to the bottom and block it

How do you block it?

 
Tigerfreerun:

How do you block it?

Move the permission to open to if

or reread it.

There's more than one option.

Любые вопросы новичков по MQL4, помощь и обсуждение по алгоритмам и кодам
Любые вопросы новичков по MQL4, помощь и обсуждение по алгоритмам и кодам
  • 2017.09.05
  • www.mql5.com
В этой ветке я хочу начать свою помощь тем, кто действительно хочет разобраться и научиться программированию на новом MQL4 и желает легко перейти н...
 
Dmitriy Voevodkin:

Init cannot be started in any way, it is automatically started once when indicator/expert is started, same as DeInit.

Alternatively, you can make a static boolean variable and use it together withIsConnected(). And when the connection is restored at the arrival of a new tick, at first it must be launched its own initialization function. ButIsConnected() would be applied not in OnCalculate(), but in OnTimer() and its initialization function should be executed at the very beginning of OnCalculate().

OnInit() is the most usual function that can be executed from any place of the code. Who prevents it? Please do not deceive people who came to learn - why? Or you will have to learn it yourself.

 
Victor Nikolaev:

Correct the error on this line

Use the SRC button to insert the code


corrected by

 

"comma txpected" before the beginning of the text remains

 

in addition, there is also a warning before the text

" implicit cjnvertion from 'string' to 'number'

not an error, of course, but also unpleasant!