Useful features from KimIV - page 127

 
khorosh:
Functions isCloseLastPosByStop() and isCloseLastPosByTake() do not always work correctly since the order close price and TakeProfit do not always coincide. I have redone it in mine. I've replaced the condition of equality of these values with the condition: the absolute value of the difference of these values (at 5-bit quotes) must be less than 5*Point.

I have set <= slippage(40*Point), but sometimes that is not enough.

 
borilunad:

I set mine to <= slippage(40*Point), but sometimes that's not enough.

Maybe the criterion should be profit or loss? I just recently put one EA on real, which uses these functions. It worked in the tester, but does not want to do it in the real account. I figured out that the difference between stoploss and close price is 2 five-digit points. That is why I set it to 5 pips.
 
khorosh:
Maybe the criterion should be profit or loss? I just recently put one EA on real, which uses these functions. It worked in the tester, but does not want to do it in the real account. I figured out that the difference between stoploss and close price is 2 five-digit points. That is why I have set 5 points.
Everything is OK in the tester, especially after optimization, while on the real account all positions are not closed in profit after SL close. The slippage at SL closing may reach 100 points instead of 40. Even with TP, there may be slippage. And by time I give an allowance of up to 5 milliseconds.
 
khorosh:
Maybe the criterion should be profit or loss? I just recently put one EA on real, which uses these functions. It worked in the tester, but does not want to do it in the real account. I figured out that the difference between stoploss and close price is 2 five-digit points. That is why I have set it to 5 points.
I should still look in the comment of a closed order with such substrings (they are always added): for stop-loss "[sl", for take "[tp". You don't need to add a closing parenthesis - they might add the price there too.
 

Good day all!

Please tell me if you can change the value of MAJIC NUMBER in an order which has already been closed and appears in the list of closed orders.

I.e., change the value of MAJIC NUMBER after the order is closed.

If it is possible, then which function should be used to change it. I did not find such a function in Kim's work.

Thank you.

 
ANDREY:

Good day all!

Please tell me if you can change the value of MAJIC NUMBER in an order which has already been closed and appears in the list of closed orders.

I.e., change the value of MAJIC NUMBER after the order is closed.

If it is possible, then which function should be used to change it. I did not find such a function in Kim's work.

Thank you.


If you want to open a new order, you should select this order from the history, take from it what you need: type of trade, volume, etc. And then through the conditions of opening an order or setting a pending order you have to enter another magis with the parameters that you took.
 
There doesn't seem to have been a conversation in this thread for a long time
 
NikolayVS89:
There doesn't seem to have been a conversation in this thread for a long time.

There are other threads.
 
Igor Kim:

The GetAmountLotFromOpenPos() function.

This function returns the sum of lots of open positions. A more accurate selection of positions to be taken into account is specified by external parameters:

  • sy - Name of market instrument. If this parameter is set, the function will consider only positions of the specified symbol. The default value "" means any market instrument. NULL means the current instrument.
  • op - Trade operation, position type. Valid values: OP_BUY, OP_SELL or -1. The default value -1 means any position.
  • mn - Position identifier, MagicNumber. Default value -1 means any identifier.
ZY: Attached is a script to test GetAmountLotFromOpenPos() function.
The function doesn't work. How do i get it to work? why does it always give out null?
 
Moderators, how do you not get lost here? In half an hour I've been in three threads with this function, I've been answered somewhere, now I can't find my question or answer
Reason: