[ARCHIVE]Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Can't go anywhere without you - 5. - page 73

 
silhouette:

I have written a function that should determine whether the position exists based on the entered tag and comment. If not, it should return the permission to open it.

When I use one trade signal in the Expert Advisor, everything works fine: it opens a position only when there is no other with the same conditions. But when the Expert Advisor works with several types of signals that I label with a different comment, it opens multiple positions. What is the problem?

Your "basic" for loop does not work. It will in any case say either true or false on the first order and will not look any further
 
OrderSend(Symbol(), OP_BUYSTOP, Lot, PriceBuy, StopLoss, TakeProfit, "Order", 0, Green);

When such an order is placed, error 130 is generated. SellStop also opens similarly, but there are no errors in it.

 
ilunga:
Your "basic" for loop does not work. It will in any case say either true or false on the first order and will not look any further

Thank you! I understand the logic. But how can it be fixed?
 
gain:
OrderSend(Symbol(), OP_BUYSTOP, Lot, PriceBuy, StopLoss, TakeProfit, "Order", 0, Green);

When such an order is placed, error 130 is generated. SellStop also opens similarly, but there are no errors in it.


And how do the price specified in the order and the current market price correlate when an error occurs?
 
MikeM:

How does the price in the order relate to the current market price when an error occurs?
There is nothing wrong with the price, it is far away
 
gain:
There is nothing wrong with the price, it is far away


Specify exact values and order type!!!
 

BuyStop is a pending order to buy assets in a financial instrument at a price higher than the current price. The order will be executed (converted into a market Buy order) if the Ask price reaches or is above the price stated in the order. What about the execution of the red condition?

 
MikeM:

BuyStop is a pending order to buy assets in a financial instrument at a price higher than the current price. The order will be executed (converted into a market Buy order) if the Ask price reaches or is above the price stated in the order. What about the execution of the red condition?



Type BUYSTOP. Even if we manually enter 1.3300 for EUR/Dollar and run the test today, the order will not open.
 
WindSW:

How to write it correctly, so that value of double is written only once and only at zero value. I tried if(recRes==0) recRes=NormalizeDouble(Res,5); but it does not work, the value is overwritten as soon as Res changes. What is the right way to implement it?


And what do you get?
What is therecRes type?
And what are the values
ofRes?

 
gain:


BUYSTOP type. Even if I manually prescribe 1.3300 for Euro/Dollar and run a test for today, the order will not open.

What is the message when doing this?
Reason: