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

 
PGM5:


Hello. How about removing everything else and leaving only this:

First two orders are set: buystop and sellstop orders with takeprofit only . Then when one of them is opened, the second one is deleted. The same pair of orders is also placed again. And again, when one of them opens or when takeprofit triggers, the same pair of orders is set. This is the cycle.

I thank you in advance.

Actually, your first algorithm is not complex either. If I understood it correctly, then when a pending order triggers, we need to find the nearest to the newly opened position (from the triggered order) opposite pending order and delete it?

If I understand it correctly, there is nothing complicated here.

 
Good morning!!! What is static int NomerBara=0; ?
 
I mean, what role does a static variable play, what is it and how does it behave in the programme?
 
Vladimirovits:
I mean, what role does a static variable play, what is it and how does it behave in the program?

It retains its value even when calculating the next tick, but is only visible from the function in which it is created. tyt
 
artmedia70:

Actually, your first algorithm is not complicated either. If I understood it correctly, then when a pending order triggers, we need to find the nearest to the newly opened position (from the triggered order) opposite pending order and delete it?

If I understand it correctly, there is nothing complicated here.


Thank you for your support. Can you tell me where to look for the answer to this question. Yes, one more thing: orders should be set when an order is triggered and when takeprofit is triggered and the closest one should be deleted before that. Thanks in advance.
 
PGM5:


Hello. How about removing everything else and leaving only this:

First two orders are set: buystop and sellstop orders with takeprofit only . Then when one of them is opened, the second one is deleted. The same pair of orders is also placed again. And again, when one of them opens or when takeprofit triggers, the same pair of orders is set. This is the cycle.

I thank you in advance.


If the orders are in pairs, it is easy to implement: each pair has its own magik. The magic code for each pair should be modified in each iteration, for example, the loop counter value should be added. Only if there are several EAs on one pair, it is necessary to select different "range of magiks" for each EA so they do not prevent each other. For example, a "base number" + "iteration counter" where the "base number" is an external parameter, in fact, it is a shift which should be set manually . The "iteration count" is a static variable. For the real account we should also define positions of already placed orders in case the terminal is restarted during operation.
 
artmedia70:

Actually, your first algorithm is not complicated either. If I understood it correctly, then when a pending order triggers, we need to find the nearest to the newly opened position (from the triggered order) opposite pending order and delete it?

If we have understood it correctly, then there is nothing complicated here.



If it is It is always the nearest then it can be quite simple and magicians are of course not needed. But we haven't heard anything about that from PGM5, and in the general case it may not be the nearest by price, but it may be any distance from the current price and in between orders may be placed due to other reasons: we know nothing about the decision-making algorithm. We were only talking about linked orders.
 
Thank you!!! Very understandable.
 
Vladimirovits:
Thank you!!! Very clear.


and use the site search engine: typing in "static" and selecting the "documentation" category is not that difficult anymore.

are the words of borilunad. He's doing well, but he's been lagging behind the last few days )

Reason: