Mohamed Abdelwaged:
hi everyone
i'm trying to make expert that work with his own trades only but I need only the start in case of "there is an manually open trades" openbuy
I did this code but it keeps opening unlimited buy position..
could any one fix it to me.
Adaeze Igor:
!!!!!
It all depends on your trading strategy. Variants can be different.
You can check only 1 position in one bar.
You can check only 1 position in one bar.
static datetime time_bar = 0; int total=OrdersTotal(); if( time_bar != Time[0] ) for(int A=0;A<total;A++) { if(OrderSelect(A,SELECT_BY_POS,MODE_TRADES)) if(total>0 && OrderMagicNumber()!=MagicN) { time_bar = Time[0]; openbuy(); break; } }Or you can check on other parameters. This should be clearer to you. But verification is necessary, so as not to get positions on every tick
Konstantin Nikitin:
It all depends on your trading strategy. Variants can be different.
You can check only 1 position in one bar.
Or you can check on other parameters. This should be clearer to you. But verification is necessary, so as not to get positions on every tick
It all depends on your trading strategy. Variants can be different.
You can check only 1 position in one bar.
Or you can check on other parameters. This should be clearer to you. But verification is necessary, so as not to get positions on every tick
Thanks it works like when I attach the expert on chart and then breaks and that's ok with me . but when break it doesn't continue work with other loop
double OpenLongOrders=0,OpenShortOrders=0,PendLongs=0,PendShorts=0; int i; for(i=0;i<total;i++) { if(OrderSelect(i,SELECT_BY_POS)) if(OrderSymbol()==Symbol() && OrderMagicNumber()==MagicN) { int type=OrderType(); if(type == OP_BUY ) {OpenLongOrders=OpenLongOrders+1;} if(type == OP_SELL ) {OpenShortOrders=OpenShortOrders+1;} if(type == OP_BUYSTOP ) {PendLongs=PendLongs+1;} if(type == OP_SELLSTOP ) {PendShorts=PendShorts+1;} if(total==1 && OpenLongOrders==1 && OpenShortOrders==0 && PendLongs==0 && PendShorts==0) { sellstop1(); } } }
How can I make the expert when executing the 1st loop and did openbuy with magicnumber=MagicN then break and go to this loop ???
Sorry, I'm not telepathic. I'm just learning telepathy.
I do not know your trading strategy. Your code is not seen. So I showed you the direction. And then think for yourself.
I do not know your trading strategy. Your code is not seen. So I showed you the direction. And then think for yourself.
Konstantin Nikitin:
Sorry, I'm not telepathic. I'm just learning telepathy.
I do not know your trading strategy. Your code is not seen. So I showed you the direction. And then think for yourself.
Appreciated..
Sorry, I'm not telepathic. I'm just learning telepathy.
I do not know your trading strategy. Your code is not seen. So I showed you the direction. And then think for yourself.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
hi everyone
i'm trying to make expert that work with his own trades only but I need only the start in case of "there is an manually open trades" openbuy
I did this code but it keeps opening unlimited buy position..
could any one fix it to me.