[Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2. - page 511

 
Kreol:

Hello !

Looking for a script, topic created here https://forum.mql4.com/ru/42138 advised to contact here for help.

Thanks in advance!


You have been advised - look here, dig the codebase - don't forget to share your results.
 
Roman.:

You were told to look here, dig the codebase - don't forget to share your results.

I wrote that I couldn't find anything there :(
 

Also not the same, because to open a position on limit or market you need to use different scripts + you have to find the instrument itself and open its window + there is no partial closing of positions.
 
I've already told you the address where it will be done exactly the way you want it done, I won't repeat it.
 
Top2n:
there's something wrong here!


Of course it's not:

bool TimeBars()
{
int prevtime = 0;
if (Time[0] == prevtime) return(0); // Бар прежний, а следовательно выходим
   prevtime = Time[0]; // Свежий бар, запоминаем время
}
There's a mandatory zeroing before the comparison.
 
static int prevtime;
 
xrust:
I've already told you the address where it will be done exactly the way you want it done, I won't repeat it.

Yeah, yeah, I hear you... but before I give you my money I'd like to make sure the script I need isn't freely available
 

Good afternoon.

There are 4 orders, 2 sells and 2 buys. Seals are created, figuratively speaking, when the price goes up and buy when it goes down. The sells are deleted when a buy is created and vice versa. When a ticket is created, the 1st sell or buy is stored in the variable pos. All 4 have the same comment - "Aelit". So, there is a code:

if (OrderSelect(pos, SELECT_BY_TICKET, MODE_TRADES))
    if (OrderComment() == "Aelit")
    {
    ...
    OrderModify(OrderTicket(), OrderOpenPrice(), NormalizeDouble(OrderOpenPrice()+0.0001, Digits), OrderTakeProfit(), 0);
    ...
    }

Theorder is selected normally by the ticket, but very often the comment comparison fails. For interest, I made else Alert(OrderComment()); and the log showed "Alert: Aelit[sl]". What is [sl]? Is it because all orders have the same comment? Then why was the same [sl] when I made a comment that didn't match the others for the test? If you remove the comment check, there is a ticket error in the log for OrderModify. At first I thought the condition was reached before any order was created, but no, at that time the order is already there, and the ticket is the same in case of condition triggering and not triggering. How do I understand it?

 
Can you please advise whether it is possible to write some text in mql4 into a file, e.g. *.txt, and then retrieve this data for trading. The idea is that the EA would learn to trade itself, when the price changes by >100*Point per couple of bars, the EA would memorise these values and then try to use them (indicator value +/- n% to open an order). This could also be implemented in the EA, but after closing MetaTrader all variable values seem to be reset to zero