//+------------------------------------------------------------------+ //| 1MA Expert DAILY CHART ONLY!!!!! | //| Do NOT trade USDJPY with this!!! | //+------------------------------------------------------------------+ #property copyright "Ron Thompson" #property link "http://www.lightpatch.com/forex" // User Input extern double Lots = 0.1; extern double stoploss=7; extern double takeprofit=20; // // make sure to leave this unset // It triggers the 1st buy. // // Also, define here so it has global scope // at least, within this expert // int prevTime; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //|------------------------------------------------------------------| int init() { return(0); } //+------------------------------------------------------------------+ //| Custor indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { double MovingAvg = 10; double cMA=0, pMA=0; double p=Point(); bool found=false; bool rising=false; bool falling=false; bool bought=false; bool sold=false; int cnt=0; int err=0; int rty=0; // Only compute right after each bar move if(prevTime==Time[0]) {return(0);} prevTime=Time[0]; // Error checking if(Bars<100) {Print("Bars less than 100"); return(0);} if(AccountFreeMargin()<(1000*Lots)) {Print("We have no money"); return(0);} // PRICE_OPEN is the only stable price point for Bar0 cMA=iMA(Symbol(), 0, MovingAvg, 0, MODE_LWMA, PRICE_OPEN, 0); pMA=iMA(Symbol(), 0, MovingAvg, 0, MODE_LWMA, PRICE_OPEN, 1); if (pMAcMA) {rising=false; falling=true;} // Does the Symbol() have an open order for(cnt=0;cnt