Some help here with EA code plz

 

Hello Mladen, mrtools and coders. I need some help here. I've been developingan EA for binary options. It uses the icustom system, and follow the signals of theindicator, without the indicator needs to be attached to the graph.

Changed it to to open the order in the second :00 remainder of the candle that is ending with the sign.

For a while it worked perfectly. Opened several perfect orders. But left to enter somesigns. Every 10 signs at 6 he enters. Can help me ... What's wrong with my EA?

ea_test.mq4

Files:
ea_test.mq4  9 kb
 

Aorry for double post.

I forgot to mention that he follows the buffers call 0.. and 1 to sell

 
amerciantrader:
Hello Mladen, mrtools and coders. I need some help here. I've been developingan EA for binary options. It uses the icustom system, and follow the signals of theindicator, without the indicator needs to be attached to the graph.

Changed it to to open the order in the second :00 remainder of the candle that is ending with the sign.

For a while it worked perfectly. Opened several perfect orders. But left to enter somesigns. Every 10 signs at 6 he enters. Can help me ... What's wrong with my EA?

ea_test.mq4

Did you try setting the timer from the init section to 1 second and that way you could check if you are in the first second of the bar?

 
mladen:
Did you try setting the timer from the init section to 1 second and that way you could check if you are in the first second of the bar?

I haven't tried that Mladen... But I worry that can delay the operation.

Believes that this can be the error? You don't find anything wrong in the code? What is the correct code to change the order within the new candle?

What i change for new bar ?

{

static datetime LastBar=0;

if(Time[0]!=LastBar)

{

LastBar=Time[0];

int tmeLeft=PeriodSeconds()-0 -(int)(TimeCurrent()-Time[0]);

EventSetTimer(tmeLeft);

}

 
amerciantrader:
I haven't tried that Mladen... But I worry that can delay the operation.

Believes that this can be the error? You don't find anything wrong in the code? What is the correct code to change the order within the new candle?

What i change for new bar ?

{

static datetime LastBar=0;

if(Time[0]!=LastBar)

{

LastBar=Time[0];

int tmeLeft=PeriodSeconds()-0 -(int)(TimeCurrent()-Time[0]);

EventSetTimer(tmeLeft);

}

amerciantrader

The problem with that way is that ticks can be late (in a normal market - not after the big news - usually new tick for a new bar is almost always delayed at least 2-3 seconds). The solution for that is to have a 1 second timer, and then when the routine you wish is entered on a chosen second, kill the timer, do the job you wish to do and create new 1 second timer. That way it would be fairly secure that you will execute orders when you wish and not when broker sends ticks

 
mladen:
amerciantrader The problem with that way is that ticks can be late (in a normal market - not after the big news - usually new tick for a new bar is almost always delayed at least 2-3 seconds). The solution for that is to have a 1 second timer, and then when the routine you wish is entered on a chosen second, kill the timer, do the job you wish to do and create new 1 second timer. That way it would be fairly secure that you will execute orders when you wish and not when broker sends ticks

Hey Mladen.. I'm sorry, but I don't understand how to do it. Could write how would be this part of the code that you are saying?

Note that in this part of the code I put it to you to open the second (: 00) of thecandle that this ending.. So opens for a new full candle.

Thanks for your help. I Aprecciate ur work

int tmeLeft=PeriodSeconds()-0 -(int)(TimeCurrent()-Time[0]);
Reason: