//+------------------------------------------------------------------+
//| Signal Begin(Entry) |
//+------------------------------------------------------------------+
//if (timeprev!=Time[0]){
// timeprev = Time[0];
if (signalup!=EMPTY_VALUE&&signalup!=0)
{
Order = SIGNAL_BUY;
}
if (signaldown!=EMPTY_VALUE&&signaldown!=0){
Order = SIGNAL_SELL;
}
// }
//+------------------------------------------------------------------+
//| Signal End |
//+------------------------------------------------------------------+
//Buy
if (Order == SIGNAL_BUY && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) {
if(!IsTrade) {
//Check free margin
if (AccountFreeMargin() < (100 * Lots)) {
Print("We have no money. Free Margin = ", AccountFreeMargin());
return(0);
}
I'm working on my first EA, it's almost done but there is 1 small problem..
When I use eachtickmode it orders twice:
EA orders -> EA closes order right away -> EA opens another order -> EA closes that order correctly.
I've been trying for 2 days to find the error that makes the EA close the initial order right away, I just want one order..
Here is the code
Can anyone help me out??