/* +---------+ |H4Scalp | +---------+ Theory of operation @ orders per bar with atr/2 for TP and NO stop loss Sell everything at next bar TIME FRAME ========== H4 PAIRS ===== Any high-ATR pair ENTRY LONG ========== Beginning of bar ENTRY SHORT =========== Beginning of bar EXIT ==== ATR/2 takeprofit MONEY MANAGEMENT ================ none RISK MANAGEMENT =============== none FAILURE MANAGEMENT ================== GetLastError on every transaction VERSION HISTORY =============== 00 - initial concept */ // variables declared here are GLOBAL in scope #property copyright "Ron Thompson" #property link "http://www.lightpatch.com/forex" // user input extern double Lots=0.1; // how many lots to trade at a time extern int Slippage=2; // how many pips of slippage can you tolorate extern double ProfitMade=34; // how much money do you expect to make extern double LossLimit=45; // how much loss can you tolorate extern double TrailStop=999; // trailing stop (999=no trailing stop) extern int PLBreakEven=999; // set break even when this many pips are made (999=off) extern int StartHour=0; // your local time to start making trades extern int StopHour=24; // your local time to stop making trades // naming and numbering int MagicNumber = 200601182020; // allows multiple experts to trade on same account string TradeComment = "Shell_00_"; // comment so multiple EAs can be seen in Account History // Bar handling datetime bartime=0; // used to determine when a bar has moved int bartick=0; // number of times bars have moved int objtick=0; // used to draw objects on the chart // Trade control bool TradeAllowed=true; // used to manage trades //+-------------+ //| Custom init | //|-------------+ // Called ONCE when EA is added to chart or recompiled int init() { int i; //remove the old objects for(i=0; i=StartHour && Hour()<=StopHour) { TradeAllowed=true; } } OrdersPerSymbol=0; for(cnt=OrdersTotal();cnt>=0;cnt--) { OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES); if( OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNumber) { OrdersPerSymbol++; if(OrderType()==OP_BUY) {OrdersBUY++;} if(OrderType()==OP_SELL){OrdersSELL++;} } } //TradeBars = MathFloor(CurTime() - OrderOpenTime())/60/Period(); // TradeAllowed on close keeps from closing 'just opened' orders //if( OrdersPerSymbol>0 && (x2buy || x2sell) && TradeAllowed ) // { // // crossover, so close orders // for(cnt=0;cnt