Questions and Answers to Programmers on MQL 4

 

Who knows the code or link - please share.
The code is as follows: You need an EA to set a specified number of points of profit - Stop Loss when the price reaches a specified
Avid to put a Stop Loss when price reaches a set number of points profit.

 
Normal trailing stop - when X number of pips of profit is reached, the stop loss is set at a level that is a specified number of pips away from the current price.
 
drknn >>:
Обычный трейлингстоп - по достижении икс пунктов прибыли стоп-лосс устанавливается на уровень, отстоящий от текущей цены на указанное количество пунктов.

Yes, I understand - I need the code of MQL4 program - to clearly understand the sequence and which values are used.

And I don't need a trailing stop, I need a one-time set to an unchangeable level.

 

Search for "breakeven".

 
Roger >>:

Ищи по поиску "безубыток".

I've just finished looking through the topics in the search query - Break-even.

The result is that I couldn't find any specific code I was looking for.

 
alex12 >>:

Только сейчас закончил просмотор тем по запросу в поиске - Безубыточность.

Результат - ни одного конкретного мне нужного кода я не нашел.

Then do a search on the word "breakeven" as you have been advised.

 
alex12 >>:

Да это понятно-мне нужен код прграммы MQL4 - чтобы наглядно понять последовательность и какие значения используются.

И нужен мне не следящий Трэйлингстоп,а единожды выставленный на неизменяемый уровень.


In this case, it is very simple - we embed a standard program trawl in the EA but it goes last in function start(). Before it, there should be a construct with the following algorithm
- Declare a boolean variable and assign the value "False" to it.
- Find our order. Check if its Stop Loss is lower than its open position, then we assign our boolean variable the value "True", you know, the trawl is allowed. Otherwise we execute command return(0);
We also pass to the trawl the sign at which this particular order should be trawled, not another one, and our variable as a switch.

What happens in this case? As long as the price has not reached the level of pre-defined profit, the trawl will not work by definition. As soon as it reaches it, the stop will be pulled up. On the next tick, the EA will detect that the required order has a stop loss = its open position and it will not let the trawl operate - the switch variable will set it to false.

This is not the easiest way, but if you already have the trawl code ready, it's easier to do this than to rewrite the code, debug, test, verify....

 
drknn писал(а) >>


In this case, it is very simple - we do this by embedding a standard trawl in the EA but it goes last in the start() function. Before it, there should be a construct that uses the following algorithm
- Declare a boolean variable and assign the value "False" to it.
- Find our order. Check if its Stop Loss is lower than its open position, then we assign our boolean variable the value "True", you know, the trawl is allowed. Otherwise we execute command return(0);
We also pass to the trawl the sign at which this particular order should be trawled, not another one, and our variable as a switch.

What happens in this case? As long as the price has not reached the level of pre-defined profit, the trawl will not work by definition. As soon as it reaches it, the stop will be pulled up. On the next tick, the Expert Advisor will detect that the required order has a stop loss = its open position and it will not let the trawl operate - the switch variable will set it to false.

This is not the easiest way, but if you already have the trawl code ready, it's easier to do this than to rewrite the code, debug, test, verify....


Thank you very much for your comment, but I am only learning to program, so I have not written any simple Expert Advisor yet.
At my leisure I'll definitely use your tip - I have the ready code of trawl.
 
alex12 >>:


Большое Вам спасибо за комментарий.Но я еще только учусь программировать и пока что не написал ни одного простого советника.
На досуге обязательно воспользуюсь Вашей подсказкой - готовый код трала у меня есть.


Create a new EA in the editor. In the start() function write the following:
Alert("Bid = ",Bid);
Compile it, put it on the chart. As a result, on every tick we see a window with the message of the current Bid.
The simple Expert Advisor has been created. The main thing that it shows us is that the code of the EA is launched anew at every tick.
The OrderSend() function is used to open orders. Usually, before its use, the programmer runs the code that analyzes the flow of last candles and identifies where the order must be opened.
To be able to quickly find the parameters of functions embedded in the language, put the mouse cursor somewhere between the letters of the function name and press F1 or Ctrl+F1 - the context help for the language function opens at the bottom of the code window.
 
drknn писал(а) >>

Create a new EA in the editor. In the start() function write the following:
Compile it, put it on the chart. As a result, on every tick we see a window with the message of the current Bid.
The simple Expert Advisor has been created. The main thing that it shows us is that the code of the EA is launched anew at every tick.
The OrderSend() function is used to open orders. Before using it, the programmer usually starts to analyze the flow of the latest candlesticks and to find out where to open the order.
To be able to quickly find the parameters of functions embedded in the language, one should put the mouse cursor somewhere between the letters of the function name and press F1 or Ctrl+F1 - context help for the language function will open at the bottom of the code window.
Thank you - I have long wanted to write at least something simple, error-free EAs that would work.
 

Hello !

I have a question for all forum members and those responsible for the material contained on this site.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

At this link https://www.metatrader5.com/ru/terminal/help/indicators/trend_indicators/envelopes

at the very bottom of the page there is a Warning:

Warning: All rights to these materials are reserved by MetaQuotes Software corp.

Reproduction in whole or in part is forbidden.

Question:I need to use in my EA this indicator - Envelopes but after reading the Warning

I don't know exactly what to do.

On the Meta Quotes Software corp. website for Contacts there is only a phone number, no mailing address - so contacting them will be a problem for me -

- That's why I asked the question here.

For whom exactly and under what conditions - does the above Warning apply ?

Reason: