if ((NormalizeDouble(priceopen+start*Point,Digits)<=Bid)&&(NormalizeDouble(Bid-sl*Point,Digits)>NormalizeDouble(dist*Point,Digits)))
{
sl=NormalizeDouble(Bid-dist*Point,Digits);
Ekburg:
you are calculating the distance from the price to the order placement price, and you need from the price to the current stop!)
If a short is standing, then it is directed to the first block, if a long is standing, then it is directed to the second block, and then the trailing stops.
If shorts are good, then they go to the first block, if long, then to the second, after that the calculations, checks and the trailing stops.
i still can't do it... I only try long, I've tried so many things, I can't remember what I've done))
There is a program that opens two orders to buy or sell, say for EURAUD and AUDUSD. The programme works only if there are no open orders in the terminal for these or other pairs. If at least one order is present in the terminal, trades will not open. My question is, how to programme the opening of orders whether there are open orders in the terminal or not? I thank you in advance for your reply.
There is a program that opens two buy or sell orders, say for EURAUD and AUDUSD. The programme works only if there are no open orders in the terminal for these or other pairs. If at least one order is present in the terminal, trades will not open. My question is, how to programme the opening of orders whether there are open orders in the terminal or not? I thank you in advance for your reply.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Buf0[i]=iMA(NULL,0,8,0,MODE_EMA,PRICE_OPEN,i-1)-iMA(NULL,0,8,1,MODE_SMA,PRICE_OPEN,i);
for a yem in infinity you will be thrown when calculating -1 bar when i=0
it's better this way:
Buf0[i]=iMA(NULL,0,8,0,MODE_EMA,PRICE_OPEN,i)-iMA(NULL,0,8,1,MODE_SMA,PRICE_OPEN,i+1);
and if you need a shift as in the variant you cited by 1-n bar to the right, better implement it explicitly in the init via SetIndexShift(0,1);
Buf0[i]=iMA(NULL,0,8,0,MODE_EMA,PRICE_OPEN,i-1)-iMA(NULL,0,8,1,MODE_SMA,PRICE_OPEN,i);
for the yem to be infinite you will be thrown when calculating -1 bar when i=0
it's better this way:
Buf0[i]=iMA(NULL,0,8,0,MODE_EMA,PRICE_OPEN,i)-iMA(NULL,0,8,1,MODE_SMA,PRICE_OPEN,i+1);
and if you need a shift as in the variant you cited by 1-n bar to the right, better implement it explicitly in the init via SetIndexShift(0,1);
Thank you very much, but I understand it all perfectly, but why is it ok with iCCI and not with iMA?
you are calculating the distance from the price to the order placement price, and you need from the price to the current stop!)
If a short is standing, then it is directed to the first block, if a long is standing, then it is directed to the second block, and then the trailing stops.
If shorts are good, then they go to the first block, if long, then to the second, after that the calculations, checks and the trailing stops.
i still can't do it... I only try long, I've tried so many things, I can't remember what I've done))
Thank you very much, but I understand it all perfectly, but why does it work with iCCI and not with iMA?
There were mistakes there and there, it's just that with iCCI it's not obvious, because of the peculiarities of calculations,
and the application of MAs, in particular EMAs, I think leads to their visibility.
still nothing comes out... I'm only trying long, I've tried so many things, I don't remember what I've done))
put OrderStopLoss() instead of sl
Are you going to live on tips?
You don't need tips now, do you? :)
There is a program that opens two orders to buy or sell, say for EURAUD and AUDUSD. The programme works only if there are no open orders in the terminal for these or other pairs. If at least one order is present in the terminal, trades will not open. My question is, how to programme the opening of orders whether there are open orders in the terminal or not? I thank you in advance for your reply.
There is a program that opens two buy or sell orders, say for EURAUD and AUDUSD. The programme works only if there are no open orders in the terminal for these or other pairs. If at least one order is present in the terminal, trades will not open. My question is, how to programme the opening of orders whether there are open orders in the terminal or not? I thank you in advance for your reply.
Remove check
Remove the check
If anyone wants to help me (see above), I am open to collaboration.