Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 28

 
Vinin:

Try usingDoubleToStr


Thank you very much.

I understand that the terminal counts the exact values and only shows me the "truncated" ones, right? And to see the exact values you have to doDoubleToStr?

 
lottamer:


Thank you very much.

I understand that the terminal counts the exact values and only shows me the "trimmed" ones, right? And to see the exact values I have to doDoubleToStr?


Yes
 
help me with this part of the code (goto is missing)
check for an open or pending order at nnn if not, place a stoploss order
 
sdm:
Help me with this part of the code (goto is missing)
I need to check if there is an open or pending order at nnn price and if not place a stoploss order.

So how would goto help you?

Use OrdersTotal() to get the number of open and pending orders.

Accordingly, if there are any, then you do an overshoot and compare the opening price of each order with your nnn.

If there are no orders, then you set yours.

Where is the goto missing here?

 
PapaYozh:

So how would goto help you?

Use OrdersTotal() to get the number of open and pending orders.

Accordingly, if there are any, then you do an overshoot and compare the opening price of each order with your nnn.

If there are no orders, then you set yours.

Where is the goto missing here?


1 I do not need all orders but only sell and sellstop // correction

I still don't understand how to exit the loop and place the order (all the time I try to place the order without going through the loop) or how to get back into the loop.

 
sdm:


1 I do not need all the orders, but only sell and sellstop

2 I don't know how to exit the loop to buy (all the time I place orders without going through the whole loop) or back into the loop

1. Who or what prevents you from analyzing the order type?

Create a flag variable, initialize it, check the order and, if necessary, change the value of the flag variable. After the loop, depending on the value of the flag, place the order.

Is this clear?

 
PapaYozh:

Is that clear?


Got it, thanks.
 
sdm:

I can't get the punctuation right :-)

Print("Orders By ",Koob,", Orders Sell = ",Koos);

oo=0; // flag if the order exists

if (Koos <= Koob) // if open!Sell order is less than or equal to the amount of open orders by

for (i=0; i<k; i++)

{if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))

{if (OrderType()==OP_SELL || OrderType()==OP_SELLSTOP) // then if there is an open or pending sell order

{ if (PraiceSs = OrderOpenPrice()) { oo=1; } //with PraiceSs set to oo

}

}

}

if (oo=0) {OrderSend(Symbol(),OP_SELLSTOP,v,PraiceSs, ,Sl,Tp, ,mn,0,Green);} //put sellstop

says the line " if ( PraiceSs= OrderOpenPrice()) { oo=1; } " - '=' - illegal assignment used

ps PraiceSs -double, oo -int

First, it is an equality comparison operation '=='.

Second, variables of the double type cannot be compared on equality. Instead, they must be compared on proximity: MathAbs( PraiceSs - OrderOpenPrice() ) <= PriceDelta

 
PapaYozh:

First, the comparison operation for equality is "==".

Second, variables of the double type cannot be compared on equality, they must be compared on closeness: MathAbs( PraiceSs - OrderOpenPrice() ) <=


what is thePriceDelta then? no orders can be closer than 30 pips

and why can't they be compared?

 
sdm:


whichpriceDelta should we set? no orders closer than 30 pips

And why can't they be matched?

PriceDelta = Point * 30;

Comparing real numbers

Reason: