/* +--------+ |2MA Divergence Trader +--------+ */ // 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 int Fast_TimeFrame=0; extern int Fast_Period=28; extern int Fast_Price = PRICE_OPEN; extern int Fast_Mode = MODE_SMA; extern int Fast_Shift=0; extern int Slow_TimeFrame=0; extern int Slow_Period=73; extern int Slow_Price = PRICE_OPEN; extern int Slow_Mode = MODE_SMA; extern int Slow_Shift=0; extern double DVBuySell=0.002; extern int MAXTrades=5; // number of trades to have open at once extern double ProfitMade=100; // how much money do you expect to make extern double LossLimit=72; // how much loss can you tolorate extern int 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 extern int BasketProfit=9999; // if equity reaches this level, close trades extern int BasketLoss=9999; // if equity reaches this negative level, close trades // naming and numbering int MagicNumber = 200601182020; // allows multiple experts to trade on same account string TradeComment = "2MA_DivergenceTrader_04_"; // 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 int tickcount=0; // Trade control bool TradeAllowed=true; // used to manage trades // Min/Max tracking double maxOrders; double maxEquity; double minEquity; double CECount; double CEProc; double CEBuy; double CESell; //+-------------+ //| Custom init | //|-------------+ // Called ONCE when EA is added to chart or recompiled int init() { int i; string o; //remove the old objects for(i=0; i