[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 316

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
Please advise how to teach the program to remember the last used variables. I need to remember the symbol, timeframe, box, reverse, width and number of bars. After the settings selected by a user, they would be saved somewhere and subsequently, if the parameters are saved somewhere, they would be loaded from there. What to use, what to do?
Press F7
This will open the EA Properties.
In the "Input parameters" tab, press the "Save" button.
You can load saved parameters in the same way.
A picture (with the algorithm) doesn't fit, so I've attached it.
Here is the gist. (1) The EA should open an order and set s\l, t\p, lot. (2) If there has been a profit in the trade, it simply repeats it.(3) If there is a loss, it changes some values and a new order with them, and so on, until there is a profitable trade. (4) Then it restores the initial values from point 1 and repeats everything. It is not possible to arrange a cycle (point 3) with exit from it if there was a profit in the trade, and restore the initial parameters after exit from it.
Help with a couple of functions. The picture (with the algorithm) is not inserted, so I have attached it.
But actually this thread is for novice programmers, not novice traders.
This is where you discuss errors in code.
Do you at least have a code sketch of your algorithm?
it looks like you don't have them attached.
there is a problem with the loop and restoring the initial values after exiting the loop.
What kind of a blueprint is it? The question is "what does the Do while analog from VB look like and how do I put the profit value (result) of the last order into a variable?
Read the tutorial first https://book.mql4.com/ru/
There is no full analogue of do loop with pre and post checks, but there is a normal while (post check can be represented by for).
Programs are not exactly linear, it's easier to focus on events, instead of looping the start procedure.
Here is an approximate scheme,
1. set SL,TP...
2. check the number of open orders, if there is less than one, a new order is opened.
The logic of the block diagram is still suffering, there are many questions to which it doesn't respond. For example, what will happen if several EAs are launched, or what will happen if we restart the EA before closing an order, etc.?
Please advise how to get rid of the error symbol name for MarketInfo function must be a string
what could be wrong with this
here in the code
{
if (lot1 < MarketInfo(NULL,MODE_MINLOT)) {lot1=MarketInfo(NULL,MODE_MINLOT);lot2=lot1*2;lot3=lot1*3;lot4=lot1*4;lot5=lot1*5;
}
or here
STOPLEVEL = MarketInfo(Symbol(),MODE_STOPLEVEL);