//+------------------------------------------------------------------+ //| AUDJPYWednseday1500 | //| Copyright © 2009 | //| www.EarnForex.com | //+------------------------------------------------------------------+ //* Based on Wednesday AUD/JPY Strategy: //* http://www.earnforex.com/forex-strategy/wednesday-aud-jpy-strategy //* Trades only on bars' open on 15:00 EST each Wednesday with AUD/JPY pair #property copyright "Copyright © 2009, EarnForex.com" #property link "http://www.earnforex.com" extern double Lots = 0.1; extern int Slippage = 5; extern int Server_EST_Difference = 6; double Poin; int Deviation; int LastBars = 0; int ticket = -1; int HourToCheck; int DayToCheck; int init() { Poin = Point; Deviation = Slippage; //Checking for unconvetional Point digits number if ((Point == 0.00001) || (Point == 0.001)) { Poin *= 10; Deviation *= 10; } if ((15 + Server_EST_Difference) > 23) { HourToCheck = 15 + Server_EST_Difference - 24; DayToCheck = 4; } else { HourToCheck = 15 + Server_EST_Difference; DayToCheck = 3; } return(0); } //+------------------------------------------------------------------+ //| Checking time and date then posting order or closing position | //+------------------------------------------------------------------+ int start() { //Wait for the new Bar in a chart. if (LastBars == Bars) return(0); else LastBars = Bars; if ((Hour() == HourToCheck) && (DayOfWeek() == DayToCheck)) { ticket = fSell(); } else if (((Hour() != HourToCheck) || (DayOfWeek() != DayToCheck)) && (ticket != -1)) { fClose(); } return(0); } //+------------------------------------------------------------------+ //| Sell | //+------------------------------------------------------------------+ int fSell() { RefreshRates(); int result = OrderSend(Symbol(), OP_SELL, Lots, Bid, Deviation, 0, 0, "AUD/JPY Wednesday 15:00 EST"); if (result == -1) { int e = GetLastError(); Print(e); } else return(result); } //+------------------------------------------------------------------+ //| Close an order | //+------------------------------------------------------------------+ void fClose() { RefreshRates(); OrderClose(ticket, Lots, Ask, Deviation); }