Need Help_avoid ea open new position in same price

 

dear senior and forum community, please help

i trade with grid using ea, i want ea open new position only if no position in the same area

example using grid 50 point, current price is 1.5000, then price move to 1.5050 (if no position active at 1.5050 then open new buy, but if there is active position at 1.5050 then no open position)

what kind of code i can implement? thanks

 
juwan:

dear senior and forum community, please help

i trade with grid using ea, i want ea open new position only if no position in the same area

example using grid 50 point, current price is 1.5000, then price move to 1.5050 (if no position active at 1.5050 then open new buy, but if there is active position at 1.5050 then no open position)

what kind of code i can implement? thanks


what you can implement is anything ....

but what have you tried...

or what do you think you have to do

 
juwan: what kind of code i can implement?
How should we know? We don't know even IF you can code. You have only three choices: Search for it, learn to code it, or pay someone. We're not going to code it FOR you. We are willing to HELP you when you post your attempt (using SRC) and the nature of your problem.
 

i wan to learn it sir, usually i made simple ea with iCustom, but in this project i really don't know what to do, i asked google but no reference, please give me some guidance..thanks

 
juwan:

i wan to learn it sir, usually i made simple ea with iCustom, but in this project i really don't know what to do, i asked google but no reference, please give me some guidance..thanks


Show how do you get the highest buyposition of your EA checking open trades

 
you have to walk through the opened orders (not history) and check the symbol, price, and preferably the magic number too.
 
szgy74:
you have to walk through the opened orders (not history) and check the symbol, price, and preferably the magic number too.
not preferably .... you just have to do that too...
 
deVries:
not preferably .... you just have to do that too...

yes, for a good, stable soltuion.

howewer, the task can be done without this, but you have to keep in mind all the limitations and possible problems.

 
szgy74:

yes, for a good, stable soltuion.

howewer, the task can be done without this, but you have to keep in mind all the limitations and possible problems.


avoid possible problems you know you can get.....

so doing the task without checking magicnumber EA is no good solution.....

 
deVries:


avoid possible problems you know you can get.....

so doing the task without checking magicnumber EA is no good solution.....


surely, it is true as general guideline.


here, for the asker, he may decide if he wants to work on these issues or use only this EA on the account (or symbol).

 
szgy74:

surely, it is true as general guideline.


here, for the asker, he may decide if he wants to work on these issues or use only this EA on the account (or symbol).


that's not avoiding issues .....

if you like this discussion having issues then why

szgy74:
you have to walk through the opened orders (not history) and check the symbol, price, and preferably the magic number too.

check the symbol ??? it might be the OP wants his EA to use it only on one symbol and is not trading manual or with other EA's

but do you really think the OP comes here opening a topic for answers like that....

there is enough bad coding made and posted also at Code Base

make your code work in all possible situations you can think it could happen

Reason: