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

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
Aren't you afraid of getting caught up in frequent requests? After all, every 15-30 seconds you will have to either open a new position in addition to the one you already have, or delete the one you already have.
You will not be able to change the volume of an open position. Therefore, you will have to split it into several positions.
EA Features
One possible way of adjusting the lot:
Open a new small position every 15-30 seconds, which you close all together when you reach your desired profit.
One possible way of adjusting the lot:
Open a new small position every 15-30 seconds, which you close all together when you reach your desired profit.
Good afternoon.
There is an EA, it has the ability to select an order that opened before the EA appeared on the chart. And specifically for this order there is one closing condition. Let us say that we have a sell order and the price conditionally rises, then this order will be closed as soon as the EA is shown. So, everything closes fine and as expected. But we can't get past the condition where there is a check for the time of closing. I alerted on this function before the condition and it returns 0! Why? It's written in documentation that only open and pending returns zero. Why does this function return zero for closed ones as well? I tried to pause for one second after closing (you never know, maybe the data didn't come) but it still returns zero. Here is the code of this section:
Thank you for your attention.
Guys, please advise how to place 2 orders at once. Nothing works.
// If the nearest maximum is close to the market entry, set an OP_SELLLIMIT order
if (max<min)
{
1 - OrderSend(Symbol(),OP_SELLLIMIT,lot,cena_sell,3,sl_sell,tp_sell,"",1,0,Red);
Alert (GetLastError()); // Error message on order placement
//order_opened = true; // if the order has kicked in, do not open
2 - OrderSend(Symbol(),OP_SELLLIMIT,lot_1,cena_sell_d_1,3,sl_sell,tp_sell_d_1,"",2,0,Red);
Alert (GetLastError()); // Alert to order setting error
}
else // otherwise set order OP_BUYLIMIT
{
OrderSend(Symbol(),OP_BUYLIMIT,lot,cena_buy,3,sl_buy,tp_buy,"",5,0,Blue);
Alert (GetLastError()); // Error message on order placement
//order_opened = true; // if the order has worked, do not open again
For some reason, only one order opens:
1 - OrderSend(Symbol(),OP_SELLLIMIT,lot,cena_sell,3,sl_sell,tp_sell,"",1,0,Red);
Alert (GetLastError()); // Order setting error message
to sergey_r:
What does it say in the errors? Specifically, what is the error code?
if set:
int order = OrdersTotal(); // Check if orders are set
if (order == 0)
it opens either selllimit or buylimit on condition and I need either two selllimit orders or one buylimit order
to sergey_r:
You don't get it. What is displayed in Alert(GetLastError();)?
to sergey_r:
As you said above, it has to do with the second StopLoser. You're probably calculating it incorrectly there. Check the segment where it's calculated carefully.
Just in case, here is the error transcript: https://docs.mql4.com/ru/trading/errors