[ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4. - page 59

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
see here: https://www.mql5.com/ru/forum/135030
Please tell me how to write a simple command:
- totransfer an order to a lossless position for a given number of pips
Can you please tell me how to write a simple command:
- Set in an open order, stoploss to breakeven (considering the spread) at a certain amount of profit in the trade.
here is a function to convert all orders with the same magic number to b/w, try to experiment with it
IgorM
Here is my EA code: Where do I want to insert the Breakeven function?
extern int tp = 0;
extern int sl = 0;
extern int BeginHour = 0; // start time
extern inttern EndHour = 0; // end time
int start()
{
//----
if(OrdersTotal()==0 && Hour() >= BeginHour && Hour() < EndHour && Close[1]<Open[1] && High[1]<Bid) // check if the price of the previous bar is lower than the open one. Buy order when the price of reaches the Bid price of the current bar, the high level of the previous bar.
OrderSend(Symbol(),OP_BUY,1,Ask,0,Ask-sl*Point,Ask+tp*Point,"",777,0,Red);
if(OrdersTotal()==0 && Hour() >= BeginHour && Hour() < EndHour && Close[1]>Open[1] && Low[1]>Bid) // check if the order is opened and the close price of the previous bar is lower than the open price. Buy order when the price reaches the current bar price Bid , high level of the previous bar.
OrderSend(Symbol(),OP_SELL,1,Bid,0,Ask+sl*Point,Ask-tp*Point,"",777,0,Red);
//----
return(0);
}
Here's my EA code: Where should I put the Breakeven function?
I think at this stage it's enough to add my function to the end of your code and do the following in your code at least:
if(OrdersTotal()> 0) MovingInWL(777);
Add to the beginning of your code
extern int LevelWLoss = 100; // Breakeven level in pips
extern int LevelProfit = 300; // Profit level in pips
I have doubts that you will solve this problem by yourself :)
You can. It is also possible to manage an account from a computer that is set up at work, or vice versa, when you are at home.
I tried to re-do someone else's function, and "a little" messed up, here's a piece of code:
I wanted it to find a certain value in first 10 lines of test.txt file and if the number of lines is more than 10 it will give error "Error! There should be no more than 10 records in the file!", but for some reason it still goes through all the records, please help me to fix it, and if you can simplify the code and make it as a separate function.
People, please explain in a simple form, what is parameter transfer by reference. I read documentation, but understood only that it is possible and after variable identification it is obligatory to put modifier &. It would be great if the explanation was accompanied by a small program with explanations... What is the difference between usual parameter passing and passing parameters by reference?