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

 
PapaYozh #:

You see, Artyom, programming is my speciality. I have been doing it since about 1989. Of course, in the beginning it was just a hobby, but it has grown into a profession. That's why I reacted to the phrase"If arrays, structures ... are passed by reference", and since this thread is for newbies, I decided to make, so to speak, a clarification.

I wasn't trying to troll you.

You missed my main message. It was not in passing by reference, but that if in general any variable is passed there, you should read the reference - to understand what it is passed there for.

Ok. Finished.

 

Guys, please help from anyone who is available! MQL4

If it were earlier I would have done it myself. Now my head is only working on simple tasks, so I don't have to explain why.

I received this order a week ago for writing trailing stop. Sent it to a client, but it didn't work for him.


New task:

We set it on 1 chart, it trawls all positions in the terminal, it's clear here - timer work.

Trawl works for single positions as well as for a group of positions, it transfers everything to one level.

"I would like to see my stop loss levels it moves before moving the stop loss.

Dotted lines or a straight line is fine with me.

I want the stop-loss line and the pips lines to activate the trailing stop-loss at each designated point I set.

Then when it reaches target 1, it moves SL to enter, then target 2 moves SL to target 1 and so on to at least 7 targets."


 

How do you automate the calculation of risk?

I think through google tables. Website intrade, need to take the deposit value from there. Look at the code of the page? I am:

<div class="balance" style="vertical-align:top;margin-top:17px;">
        <i class="material-icons" style="vertical-align:sub;margin-right:5px;"> credit_card</i>
        <span class="lightgray"></span><span id="balance"> 6 020,00 RUB</span>
</div>

We are using the function =IMPORTHTML

?
What kind of "query"?

Either a table or a string. Is the deposit value a string? If at all in that direction I am digging

 
Vitaly Muzichenko #:

Guys, please help from anyone who is available! MQL4

If it were earlier I would have done it myself. Now my head is only working on simple tasks, so I don't have to explain why.

I received this order a week ago for writing trailing stop and the reason is that I have already had it. Sent it to a client, but it didn't work for him.


New task:

Set it on 1 chart, it trawls all positions in the terminal, it is clear here - timer work.

The trawl works both for single positions and for a group of positions, it transfers everything to one level.

"I would like to see my stop loss levels it moves before moving the stop loss.

Dotted lines or a straight line is fine with me.

I want the stop-loss line and the pips lines to activate the trailing stop-loss at each designated point I set.

Then when it reaches target 1, it moves SL to enter, then target 2 moves SL to target 1 and so on to at least 7 targets."


What is a pips line? If I understand correctly he wants to set targets for price and for stops. Price reached the first target, the stop moved to the first level. Reached the second, the stop moved to the second level.
 
Valeriy Yastremskiy #:
What is the pips line? If I understand correctly it wants to set targets for price and for stops. The price reached the first target, the stop moved to the first level. Reached the second, the stop moved to the second level.

There is a position and a stoploss on it.

In the settings the trawl is 30. So show the line at the level where trawl will trigger, and so all 7 lines: 30-60-90-120-150-180-210, like progression.

Passed 30 and reached the line, the trawl moves stops to the open price level, upon reaching 60, moves stops to +30 from the open price, i.e. to the level where the first stop triggered, etc.

I assume it wants to control the chart lines, but this is more complicated, so needs to be simplified.

Alternatively, put 7 parameters for levels in the settings.

P.S. Sorry for the long reply, was losing internet.

 
Vitaly Muzichenko #:

There is a position and a stoploss on it.

In the settings the trawl is 30. So show the line at the level where trawl will trigger, and so all 7 lines: 30-60-90-120-150-180-210, like progression.

Passed 30 and reached the line, the trawl moves stops to the open price level, upon reaching 60, moves stops to +30 from the open price, i.e. to the level where the first stop triggered, etc.

I assume it wants to control the chart lines, but this is more complicated, so needs to be simplified.

Alternatively, put 7 parameters for levels in the settings.

P.S. Sorry for the long reply, was losing internet.

To draw (ok, display) levels "like-progression, hereafter there can be a stop loss" is generally speaking quite simple. But it is not very clear WHY.

Have not tried to ask the customer, what he wants there in detail?

PS / and yes, you have to take a "creative pause", I think the customer will understand the situation ... nerves do not contribute

 
Maxim Kuznetsov #:

drawing (okay, mapping) "progression-type levels, there may be a stop loss" levels is generally speaking quite easy. But it is not very clear WHY.

Have not tried to ask the customer, what he wants there in detail?

PS / and, yes, it is necessary to take a "creative pause", I think the customer will understand the situation.

He's been thinking for over a week and it's been decided.

Originally it was different, it was handed in, but after a week's pause he reported the innovations. I understand that the assignment has been completed, but it feels wrong to leave the customer, even if it wasn't part of the original TOR.

My request still stands!

 
Vitaly Muzichenko #:

He thought for more than a week and it was decided.

Originally it was different, that's what was handed in, but after a week's pause he reported the innovations. I understand that the assignment was completed, but somehow it doesn't feel right to leave the customer, even if it wasn't part of the original ToR.

My request is valid!

Calm down Vitaly, the request of what?

to make edits to the EA ? there is no code and nowhere to make edits. And it's not quite correct to edit the freelance order in this thread. In general, neither side

void OnStopLoss() {

    // some code placed here

}

is unlikely to help.

 
Maxim Kuznetsov #:

Calm down Vitaly, what is the request?

To make edits to the EA? There is no code and nowhere to make edits. And it's not quite correct to correct the freelance order in this thread. In general, neither side

void OnStopLoss() {

    // some code placed here

}

is hardly helpful.

Not really an EA, a separate trawl that hangs on one chart and keeps track of all the symbols.

The code is heavily bloated

 
Vitaly Muzichenko #:

There is a position and a stoploss on it.

In the settings the trawl is 30. So show the line at the level where trawl will trigger, and so all 7 lines: 30-60-90-120-150-180-210, like progression.

Passed 30 and reached the line, the trawl moves stops to the open price level, upon reaching 60, moves stops to +30 from the open price, i.e. to the level where the first stop triggered, etc.

I assume it wants to control the chart lines, but this is more complicated, so it needs to be simplified.

Alternatively, put 7 parameters for levels in the settings.

P.S. Sorry for the long reply, was losing internet.

7 parameters is not an option) 7 names of horizontal lines in the parameters it will draw and name. And we will dance from them. And if the parameters, the range of price movement and the number of levels. Calculate and draw. Well, when the level triggers, it should draw the sl line and if the sl coincides with the price level, it should change its colour.
Reason: