Good for the day
That depends on the mql4 programmer.
Here is some example code:
bool IsGoodForToday(double nPips, int MagicNumber) { // initialize variables datetime Today = TimeCurrent() - (TimeCurrent()%(PERIOD_D1 * 60)); double CumulativePoints = 0; int nPoints = 0; // adjust for 3/5 digit brokers if (Digits == 3 || Digits == 5) nPoints = nPips * 10; else nPoints = nPips; // review trade history for (int i = OrdersHistoryTotal() - 1; i >= 0; i--) if (OrderSelect(i, SELECT_BY_POS, MODE_HISTORY)) if (OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber && OrderType() <= OP_SELL) if (OrderCloseTime() >= Today) switch (OrderType()) { case OP_BUY: CumulativePoints = CumulativePoints + (OrderClosePrice() - OrderOpenPrice()); break; case OP_SELL: CumulativePoints = CumulativePoints + (OrderOpenPrice() - OrderClosePrice()); break; } // return result return ((CumulativePoints / Point) >= nPoints); } int start() { if (IsGoodForToday(10, 100)) Print ("Yes!"); else Print ("oh no!!"); return(0); }
Hi
HoW easy is it to program a Good For The Day where;
the EA will look at order history just for the day and see if it has gotten like 10 pips?
thx