[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 1078

 
RekkeR:

Thank you.


By the way, in the profiles folder there are folders belonging to each individual profile. They contain *.CHR files - you can also open them with notepad. It looks like the same syntax there.
 
rensbit:


SPS, I'll check it out.
 
Galion:

Greetings! n - variables take one of two values, variants of combinations of which should pass to p variable one of 4 values. Can you tell me how this can be in the code?

Give me a concrete example - "variants of combinations" and transferring them to a p-variable.

Why 4 values?

 
sergeev:

give a concrete example - "combination variants" and transferring them to a p-variable.

why 4 values?


Thank you, but it seems I have misled you by the wrong description of conditions)))
I'll try it this way.
bool n_1,
n_2,
n_3,
n_4,
n_5;
int p;
if n_2 && n_3 is true, then p = 101
if n_4& n_5 is true, p = 102
if n_1 && n_2&&& n_5 are true, then p = 104
if n_2 && n_3&& n_4&&&n_5 true, p = 105

there can be many variables n and you want to get away from the if set
 
Galion:

Thank you, but it seems that I have misled you by the wrong description of the conditions)))
I'll try it this way.
bool n_1,
n_2,
n_3,
n_4,
n_5;
int p;
if n_2 && n_3 is true, then p = 101
if n_4& n_5 is true, p = 102
if n_1 && n_2&&& n_5 are true, then p = 104
if n_2 && n_3&& n_4&&&n_5 true, p = 105

there can be many variables n and you want to get away from the if set


Try to use movable coding

It's begging for it.

 
Hi all! Help me, who is a beginner in mql4, to create an EA. The start of the start function: check the H1 chart for the last fully formed candlestick from the last hour. If the close price of the previous candle is higher than its open price, then we will immediately place a buy order and wait for 1 hour until the next one hour candle will be completely formed. After its complete formation, we immediately check it. If its close price is higher than its open price, we wait for the next one. If its open price is higher than its close price, we close the order.
 
drknn:


Declare a variable (a), in which we will enter the Ask price. Recalculate the orders at the start of the EA. If there are no orders, then null the variable. Then we check if the variable is equal to zero, then we add Ask price to it and place orders from this level. It is clear that on the next tick, the program will see that the orders are in place and will not affect the "A" variable that contains the previous Ask. And it is also clear that as long as there are orders in the market, the value of variable "a" will not change.

2. If we need to save the order parameters, we should request them from the server and save them in variables or in an array. You have to do it once and leave it until the order is no longer needed.

You didn't find this in the tutorial, because the author was trying to make his vision of the language as clear as possible. But this tutorial doesn't cover the issues of compa's interaction in the Server-Client system. The tutorial, as well as the help in the meta-editor only slightly touches those issues. A beginner simply doesn't think about what is happening on the current tick and what will happen on the next tick. He mistakenly thinks that everything will be the same on the next tick. But it is a serious error - the program will behave quite differently on the next tick, because the values of the variables have changed due to a new price on the previous tick! And this is especially important when building programs that operate on the principles of a cybernetic automaton - that is, that have a memory of what state the automaton is in.

Visitors to the forum can give you ready-made solutions to your problems. But it will not do you any good. The best thing is to help you understand the logic of the work and stimulate you to master the language as a tool. The best thing that you can get here is your personal knowledge which will work for you for years. Knowledge and the ability to apply it.


Thanks for the tip, but I would like to know how to memorise values using arrays. If I place pending orders and when I modify them I have to save either takeprofit or stoploss in them and change the other values. And what if the order has become a market order, we can change its takeprofit and stoploss, but in the "OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),OrderTakeProfit());" we have to indicate the opening price, how should we indicate it? I tried 0, skipping and specifying the old price, but it gives an error.
 
rensbit:

Man, that worked out great !!!!!!!!!!

THANK YOU !!!!!!!!!!!!!!!!!!!!!!!!!!!

 

Afternoon !

When using the ASCTrend1sig indicator https://www.mql5.com/ru/code/8329 (when testing an EA with it) - very slow test speed: 1 hour candle is tested for 1-2 seconds. What is it related to? Because of the indicator ?

 

Help me, a beginner in mql4, to create a start of code. The start of the start function: check the H1 chart for the last fully formed candlestick from the last hour. If the close price of the previous candle is higher than its open price, we immediately place a buy order and wait for the next one-hour candle to fully form. After its complete formation, we immediately check it. If its close price is higher than its open price, we wait for the next one. If its open price is higher than its close price, we close the order.

Which operators and commands should be used to implement this? Help me with this, or post this section of the code.

Thanks in advance!

Reason: