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

 
artmedia70:

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.

I am interested in the EA itself. Yes, and the volume of already open trade can be increased by simply adding more and decreased by partial locking.
 
sergeev:

EA Features


17
darsey 08.08.2011 12:40
Hello. Is it possible to program an EA in mql4, so it would adjust the lot every 15-30 seconds?

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.
 
DhP:

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.
Thank you. I will think about it. Actually, I have two series with 100% correlation but different volatility. I need to convert one series to the other. I don't see any way out of the situation as only intra-bar frequency lot correction. Any thoughts on this? I wish I could do HFT at home :(
 

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:

if (tempWho == 0 && pos != -1)
{
    if (OrderSelect(pos, SELECT_BY_TICKET))
    {
        ...
        //Тут закрываются ордера
        ...
            
        if (OrderCloseTime() != 0)
        {
            ...
        }
    }
}

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();)?

 
error 130. Got it, tried to make selllimit the same and everything worked I will look for where the dog is buried
 

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

Reason: