[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 168

 
Vovo4ka:

Guys need help....

Added

if (!ExistPositions()) {.........
                       ................
                        }







bool ExistPositions() {
        for (int i=0; i<OrdersTotal(); i++) {
                if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
                        if (OrderSymbol()==Symbol() && OrderMagicNumber()==MAGIC) {
                                return(True);
                        }
                } 
        } 
        return(false);
}

Well here is the problem...it opens an order and until it closes on a profit or a stop it does not open the next order, ignoring the SIGNALS for this pair!!!!

need to make it so that it does not ignore.... Help....

What is the condition? If there are no existing positions, then ...

And if they already exist? And not only positions, but also pending orders? Then the function returns false...

 
Rossi:
I've got an alert label somewhere... when the signal goes on, I hear a gurgling sound, but I can't find it in the terminal window... maybe there are some keys to pull it out?

Maybe from dampness? :)))

Sorry, couldn't resist a joke... :))))

 
todem:
Can you suggest a function that would multiply (increase) the volume if the level of available funds (or the balance level) allows it???
 
artmedia70:

Maybe from dampness? :)))

Sorry, couldn't resist a joke... :))))


ahahaaaaa........... funny, yeah...

I don't know what to call this one (half of a mercury bell)...

 
artmedia70:

What is the condition? If there are no existing positions, then ...

What if there are already positions? And not only the positions, but also the pending orders? Then the function returns false...

If there are no positions and the entry condition is met, then open a position.... with take profit and stops.... I need it to open an order at each signal, not to wait for no order condition
 
2%5=2?
 
todem:
Can you suggest a function that would multiply (increase) the volume if the level of available funds (or balance level) for this allows???
The database is full of ready functions. Almost every Expert Advisor, separately in the form of libraries, in trading scripts. How people manage to miss it, I do not understand.

Example from the base: https://www.mql5.com/ru/code/8556

And do not spam in different branches, it is better to search well.

 
I test on 5 minutes, everything goes fine, and at some point at the 02nd minute of any hour an opening 130 error starts to occur - wrong stops. It seems to open strictly on multiples of 5 minutes, I do not understand why there is an error on the 02nd? Is there a problem with the sloppy history or what?
 
granit77:
The database is full of ready-made functions. Almost every Expert Advisor, separately in the form of libraries, in trading scripts. How people manage to miss it, I don't understand.

Example from the database: https://www.mql5.com/ru/code/8556

And don't spam in different threads, it's better to do a good search.


Oh thank you!!! Too bad there's no smiley with a flower
 
Vovo4ka:
If there is no position and the entry condition is met then open a position.... with take profit and stops.... I need an order to be opened at every signal, not to wait for the condition of no orders
Exactly: If there are no positions and there is a criterion for entry. What if there is a criterion for entering and there are positions? The conditions have to be changed. For example - if a certain amount of time has passed since the last position was opened... or on a new bar or... you can come up with a lot of conditions. But according to your criterion only one position will be opened.
Reason: