//+------------------------------------------------------------------+ //| VQEA2.mq4 | //| Modified from Macd| //| By Otis16Keith| //+------------------------------------------------------------------+ extern double TakeProfit = 2000; extern double Lots = 0.05; extern int BreakEvenAt = 100; extern int BreakEvenSlide = 0; extern bool EachTickMode = True; extern int SlipPage = 3; int digit=0; int BarCount; int Current; bool TickCheck = False; double mPoint = 0.0001; int init() { BarCount = Bars; if (EachTickMode) Current = 0; else Current = 1; mPoint = GetPoint(); return(0); } int deinit() { return(0); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ datetime newbar; int start() { int cnt, ticket, total; if(newbar==Time[0])return(0); else newbar=Time[0]; if(Bars<100) { Print("bars less than 100"); return(0); } if(TakeProfit<10) { Print("TakeProfit less than 10"); return(0); // check TakeProfit } double ArrowUp = iCustom(NULL,0,"VQ",PRICE_CLOSE,0,30,5,4,3,3,1); double ArrowDown = iCustom(NULL,0,"VQ",PRICE_CLOSE,0,30,5,4,3,4,1); double HAOpen2 = iCustom(NULL, 0, "HeikenAshiSmoothed2", 1, 5, 1, 12, 2, Current + 1); double HAClose2 = iCustom(NULL, 0, "HeikenAshiSmoothed2", 1, 5, 1, 12, 3, Current + 1); double HAOpen3 = iCustom(NULL, 0, "HeikenAshiSmoothed2", 1, 5, 1,12, 2, Current + 2); double HAClose3 = iCustom(NULL, 0, "HeikenAshiSmoothed2", 1, 5, 1, 12, 3, Current + 2); total=OrdersTotal(); if(total<2) { // no opened orders identified if(AccountFreeMargin()<(1000*Lots)) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return(0); } // check for long position (BUY) possibility if(ArrowUp!=EMPTY_VALUE) //&& GreenLine>0) //RedLine!=0 && Close10) { if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("BUY order opened : ",OrderOpenPrice()); } else Print("Error opening BUY order : ",GetLastError()); //return(0); } // check for short position (SELL) possibility if(ArrowDown!=EMPTY_VALUE) //&& RedLine>0 && GreenLine!=0 && Close1>RedLine2) { ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,0/*Bid+StopLoss*mPoint*/,Bid-TakeProfit*mPoint,"macd sample",16384,0,Red); if(ticket>0) { if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("SELL order opened : ",OrderOpenPrice()); } else Print("Error opening SELL order : ",GetLastError()); // return(0); } //return(0); } for(cnt=0;cnt0) { if (OrderType()==OP_BUY) { if (MarketInfo(OrderSymbol(),MODE_BID)-OrderOpenPrice()>=mPoint*BreakEvenAt) { if (OrderStopLoss()=mPoint*BreakEvenAt) { if (OrderStopLoss()>OrderOpenPrice() - BreakEvenSlide*mPoint) OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice() - BreakEvenSlide*mPoint,OrderTakeProfit(),0,Red); } } } } } return(0); } //----------------------------------Broker Digit Conversion------------------------------------ double GetPoint(string symbol = "") //5 digit broker conversion --- Copyright "Coders Guru" { if(symbol=="" || symbol == Symbol()) { if(Point==0.00001) return(0.0001); else if(Point==0.001) return(0.01); else return(Point); } else { RefreshRates(); double tPoint = MarketInfo(symbol,MODE_POINT); if(tPoint==0.00001) return(0.0001); else if(tPoint==0.001) return(0.01); else return(tPoint); } } // the end.