I thought when sending the order cbt is set to 1 so no second order wil be sent. But on my demo account another order was set within 40 ms, how can this happen, what is wrong in that code?
How can I impeed that in the code?
Can't tell from the code you have shown . . . try printing Volume[0]
Can't tell from the code you have shown . . . try printing Volume[0]
Can't print a this because it doesn't repeat. The EA runs in 12 pairs and opened dozens of pending orders without doing a order 2 times. So I thought the logic shown above is right. But then suddenly ...
What should I print?
As EA runs in H4 chart Volume[0] is far higher than 2 ...
Can't print a this because it doesn't repeat. The EA runs in 12 pairs and opened dozens of pending orders without doing a order 2 times. So I thought the logic shown above is right. But then suddenly ...
What should I print?
As EA runs in H4 chart Volume[0] is far higher than 2 ...
But of course I know, that Volume[0] was > 2 when the Orders were placed.
In a H4 chart Volume[0] can't be <2 at 18:40h.
Or does Volume[0] jump randomly from number to number instead of counting upward?
Or is it reset to 0 sometimes in the middle of the time of a bar?
Or ist it posible that for transmission problems in internet or inside my server (mt4 runs on a server) Volume[0] isn't transmitted, so shown as 0, so <2 for the EA?
If my way to avoid double orders doesn't work always correct, what else could I write in the code?
Maybe this helps?
if(Volume[0]==1) {cbt=0;cst=0;}
Thanxx!!
But of course I know, that Volume[0] was > 2 when the Orders were placed.
In a H4 chart Volume[0] can't be <2 at 18:40h.
Thanxs for your comments guys. I'm not a programmer, learning by doing ...
@ WHRoeder: I thought about a solution with time, but isn't time lowest in seconds? Then time can't be a solution when the EA sends the 2. order within the same second.
U're right, it seems the EA is missing ticks. following code showed it, onces was printed 2 instead of 1. This can only happen if the fist tick was missed. Or am I wrong?
@ RaptorUK: Well, my EA is not looping within start(), but maybe for missing data (transmission problem) Volume[0]==0
I think with the code below Volume[0]==0 triggers nothing and the EA must miss the first 5 ticks to not trigger.
Or am I wrong?
Thanks!
static int trig;
if (Volume[0]>0&&Volume[0]<6) trig++;
if (Volume[0]>5) trig=0;
if(trig==1)
{
Print (Volume[0]);
cbt=0;
cst=0;
}
highflyer:@ WHRoeder: I thought about a solution with time, but isn't time lowest in seconds? Then time can't be a solution when the EA sends the 2. order within the same second.
| Resolution of a datetime is one second. The resolution of Time[0] is 60 seconds (M1 chart) and up. Search new bar. |
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I thought when sending the order cbt is set to 1 so no second order wil be sent. But on my demo account another order was set within 40 ms, how can this happen, what is wrong in that code?
How can I impeed that in the code?
Thanxx for help!
2014.07.23 18:40:51.796 '9013517': order was opened : #4831827 buy stop 0.40 EURAUD at 1.42480 sl: 1.42280 tp: 1.44770
2014.07.23 18:40:51.753 '9013517': order was opened : #4831826 buy stop 0.40 EURAUD at 1.42480 sl: 1.42280 tp: 1.44770
static int cbt=0; int res=0;
if(Volume[0]<2) {cbt=0;cst=0;}
if(Bid<=prlb&&cbt==0&&prlb!=0)
{
res= OrderSend(Symbol(),OP_BUYSTOP,LotAnzahlB(),..., ..);
cbt++;
}