Not execute the first trade signal

 

Hello,

If a trader just run the EA and it detects a trade signal but it is near the end signal where it is less favorable.

How to program the EA so that it will not execute the first signal after launching?

 

Sounds like a Trade Logic issue to me. If you don't want it to trade that signal then why is it there? You'll want to define (to the program) what constitutes less favorable trades. Then tell it not to place those trades until after More favorable trades have been placed. Sorry if it sounds confusing, I'm new.

 
If it is "near the end signal" why didn't it trade at the start of the signal?
 
because the trader launch the EA at the wrong timing.
 

In my EA I have a line that closes all positions at a given deadline...

if( (Time[TimeLimit]>=LastSignal || (DayOfWeek()==5 && Hour()>=20)) ) CloseAll();

What I find is the EA opens a position after the deadline and immediately closes it with the loss of a spread.

Any suggestions? Thank you, Helmut

 
engcomp:

In my EA I have a line that closes all positions at a given deadline...

What I find is the EA opens a position after the deadline and immediately closes it with the loss of a spread.

Any suggestions? Thank you, Helmut



Your code logic above seem to tell the program when to Close a position. I don't know what your code looks like for opening a position. I think you'll want to find a way to tell the program Not to Ordersend if its past "time limit" or past "friday 20 hour".
 
skyforex:
because the trader launch the EA at the wrong timing.

The terminal calls start() for EACH TICK.

Your logic is wrong.

 
engcomp:

In my EA I have a line that closes all positions at a given deadline...

if( (Time[TimeLimit]>=LastSignal || (DayOfWeek()==5 && Hour()>=20)) ) CloseAll();

What is TimeLimit. Time[X] is the time X bars ago opened. What does that have to do with when the current order opened.

The number of bars an order has been opened is

int dura = iBarShift(NULL, 0, OrderOpenTime());
And next time don't hijack someone else's Thread.