Thread: How to code?
View Single Post
  #518 (permalink)  
Old 11-30-2007, 07:52 AM
dxtrade's Avatar
dxtrade dxtrade is offline
Senior Member
 
Join Date: Jul 2007
Location: Maldives
Posts: 194
dxtrade is on a distinguished road
Close/Open trades at inversed signal

I have a small problem here:

In my EA I have a BuyCondition and Sell Condition and a close order for inversed signals. To prevent opening and closing trades inside the same bar I have the following code:
if(OneEntryPerBar==true)
{
if(CheckEntryTime==iTime(NULL,PERIOD_H1,0)) return(0); else CheckEntryTime = iTime(NULL,PERIOD_H1,0);
}

All fine. But now if he finds a sell condition during an open buy trade, he closes the buy, which is OK. But he doesn't open the sell as the above code is preventing this.

Any idea on how to make him close and open inside 1 bar... but only once per bar?

I hope I make myself understood.

Thanks
__________________
Happy Trading...

"Failure is only a temporary change in direction to set you straight for your next success."
"Winning is a habit. Unfortunately, so is losing."
"It’s so simple to be wise. Just think of something stupid to say and then don’t say it."

"Say what you mean, but don't say it mean!"
Reply With Quote