//+------------------------------------------------------------------+ //| lOT HUNTER.mq4 | //| Copyright © 2008, | //| | //+------------------------------------------------------------------+ #property copyright "Copyright © 2008,Risdyanto " #property link "" extern int numBars = 3; extern int lot = 1; extern int maPeriod = 5; extern int timeFrame =1; double support; double resist; string trendType,trendType2; string Signal; extern int daysBackForHigh = 1; extern int daysBackForLow = 1; //---- buffers double Rates[][6]; //---- double fib000, fib236, fib146, fib382, fib50, fib618, fib764, fib91, fib100, fib1618, fib2618, fib4236, range, prevRange, high, low; bool objectsExist, highFirst; //+------------------------------------------------------------------+ //| expert initialization function | //+------------------------------------------------------------------+ int init() { //---- ObjectCreate("lineSupport",OBJ_HLINE,0,0,0); ObjectSet("lineSupport",OBJPROP_COLOR,Red); ObjectSet("lineSupport",OBJPROP_WIDTH,1); ObjectSet("lineSupport",OBJPROP_STYLE,STYLE_DASHDOT); ObjectCreate("lineResist",OBJ_HLINE,0,0,0); ObjectSet("lineResist",OBJPROP_COLOR,Blue); ObjectSet("lineResist",OBJPROP_WIDTH,1); ObjectSet("lineResist",OBJPROP_STYLE,STYLE_DASHDOT); ObjectCreate("lblTrendType",OBJ_LABEL,0,0,0,0,0); ObjectSet("lblTrendType",OBJPROP_XDISTANCE,50); ObjectSet("lblTrendType",OBJPROP_YDISTANCE,20); ObjectSetText("lblTrendType","TrendType",14,"Tahoma",Red); ObjectCreate("lblTrendType2",OBJ_LABEL,0,0,0,0,0); ObjectSet("lblTrendType2",OBJPROP_XDISTANCE,50); ObjectSet("lblTrendType2",OBJPROP_YDISTANCE,50); ObjectSetText("lblTrendType2","Signal",14,"Tahoma",Red); ObjectCreate("Aris",OBJ_LABEL,0,0,0,0,0); ObjectSet("Aris",OBJPROP_XDISTANCE,50 ); ObjectSet("Aris",OBJPROP_YDISTANCE,100); ObjectSetText( "Aris", " Risdyanto Trading Expert " , 12, "Arial", Blue ); //---- return(0); } //+------------------------------------------------------------------+ //| expert deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- ObjectsDeleteAll(); ObjectDelete("fib000"); ObjectDelete("fib000_label"); ObjectDelete("fib236"); ObjectDelete("fib236_label"); ObjectDelete("fib382"); ObjectDelete("fib382_label"); ObjectDelete("fib50"); ObjectDelete("fib50_label"); ObjectDelete("fib618"); ObjectDelete("fib618_label"); ObjectDelete("fib100"); ObjectDelete("fib100_label"); ObjectDelete("fib1618"); ObjectDelete("fib1618_label"); ObjectDelete("fib2618"); ObjectDelete("fib2618_label"); ObjectDelete("fib4236"); ObjectDelete("fib4236_label"); // ObjectDelete("Aris"); //---- return(0); } //+------------------------------------------------------------------+ //| expert start function | //+------------------------------------------------------------------+ int start() { //---- MarketAnalize(); if(OrdersTotal()==0) CheckForOpen(); else CheckForClose(); //---- return(0); } void MarketAnalize() { // support = 100000; //resist = 0; for(int k = 1;k<=numBars;k++) { // if (support < iLow(Symbol(),timeFrame,k)) support = iLow (Symbol(),timeFrame,k); // if (resist > iHigh(Symbol(),timeFrame,k)) resist = iHigh(Symbol(),timeFrame,k); } ObjectSet("lineSupport",OBJPROP_PRICE1,support); ObjectSet("lineResist" ,OBJPROP_PRICE1, resist); //-------------------------------------------------------------------------------- double ma = iMA(Symbol(),timeFrame,maPeriod,0,MODE_EMA,PRICE_CLOSE,0); if(Ask>ma) { trendType = "Naik"; } if(Bidfib764) {Signal = "Reverse-Sell";} else if ((Ask && Bid > fib236) && (Ask&&Bid < fib764)) {Signal = "Trading-Area";} else if (Bid > fib91) {Signal = "Continuation";} else if (Ask < fib146) {Signal = "Continuation";}} else if(highFirst == false) {if (Bid > fib236 ) {Signal = "Reverse-Sell";} else if (Ask < fib764 ) {Signal = "Reverse_Buy";} else if ((Ask && Bid < fib236) && (Ask&&Bid > fib764)) {Signal = "Trading-Area";} else if (Ask < fib91) {Signal = "Continuation";} else if (Bid > fib146) {Signal = "Continuation";}} ObjectSetText("lblTrendType2",Signal); } } //------------------------------------------------------------------------ void CheckForOpen() { if((trendType=="Naik") && (Signal=="Trading-Area")) { if(Ask>resist) OrderSend(Symbol(), OP_BUY,lot,Ask,3,support,0);} if((trendType=="Naik") && (Signal=="Reverse-Sell") && (highFirst == false)) { if(Askresist) OrderClose(OrderTicket(),OrderLots(),Ask,3); } } OrderSelect(0,SELECT_BY_POS); if(OrderProfit()>0) { if(OrderType()==OP_BUY) { if(Bidresist) OrderClose(OrderTicket(),OrderLots(),Ask,3); } } if(OrderType()==OP_BUY) { //if((Ask>OrderOpenPrice()+Point*20)&&(OrderStopLoss()<(OrderOpenPrice()+Point*15))) // OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()+Point*15,OrderTakeProfit(),0,Blue); // if((Ask>OrderOpenPrice()+Point*30)&&(OrderStopLoss()<(OrderOpenPrice()+Point*25))) // OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()+Point*25,OrderTakeProfit(),0,Blue); // if((Ask>OrderOpenPrice()+Point*40)&&(OrderStopLoss()<(OrderOpenPrice()+Point*35))) // OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()+Point*35,OrderTakeProfit(),0,Blue); if((Ask>OrderOpenPrice()+Point*60)&&(OrderStopLoss()<(OrderOpenPrice()+Point*55))) OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()+Point*55,OrderTakeProfit(),0,Blue); if((Ask>OrderOpenPrice()+Point*80)&&(OrderStopLoss()<(OrderOpenPrice()+Point*75))) OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()+Point*75,OrderTakeProfit(),0,Blue); if((Ask>OrderOpenPrice()+Point*100)&&(OrderStopLoss()<(OrderOpenPrice()+Point*95))) OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()+Point*95,OrderTakeProfit(),0,Blue); if((Ask>OrderOpenPrice()+Point*120)&&(OrderStopLoss()<(OrderOpenPrice()+Point*115))) OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()+Point*115,OrderTakeProfit(),0,Blue); if((Ask>OrderOpenPrice()+Point*140)&&(OrderStopLoss()<(OrderOpenPrice()+Point*135))) OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()+Point*135,OrderTakeProfit(),0,Blue); if((Ask>OrderOpenPrice()+Point*160)&&(OrderStopLoss()<(OrderOpenPrice()+Point*155))) OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()+Point*155,OrderTakeProfit(),0,Blue); if((Ask>OrderOpenPrice()+Point*180)&&(OrderStopLoss()<(OrderOpenPrice()+Point*175))) OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()+Point*175,OrderTakeProfit(),0,Blue); if((Ask>OrderOpenPrice()+Point*200)&&(OrderStopLoss()<(OrderOpenPrice()+Point*195))) OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()+Point*195,OrderTakeProfit(),0,Blue); if((Ask>OrderOpenPrice()+Point*220)&&(OrderStopLoss()<(OrderOpenPrice()+Point*210))) OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()+Point*210,OrderTakeProfit(),0,Blue); if((Ask>OrderOpenPrice()+Point*240)&&(OrderStopLoss()<(OrderOpenPrice()+Point*230))) OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()+Point*230,OrderTakeProfit(),0,Blue); if((Ask>OrderOpenPrice()+Point*260)&&(OrderStopLoss()<(OrderOpenPrice()+Point*250))) OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()+Point*250,OrderTakeProfit(),0,Blue); } if(OrderType()==OP_SELL) { // if((Bid(OrderOpenPrice()-Point*15))) // OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()-Point*15,OrderTakeProfit(),0,Blue); // if((Bid(OrderOpenPrice()-Point*25))) // OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()-Point*25,OrderTakeProfit(),0,Blue); // if((Bid(OrderOpenPrice()-Point*35))) // OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()-Point*35,OrderTakeProfit(),0,Blue); if((Bid(OrderOpenPrice()-Point*55))) OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()-Point*55,OrderTakeProfit(),0,Blue); if((Bid(OrderOpenPrice()-Point*75))) OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()-Point*75,OrderTakeProfit(),0,Blue); if((Bid(OrderOpenPrice()-Point*95))) OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()-Point*95,OrderTakeProfit(),0,Blue); if((Bid(OrderOpenPrice()-Point*115))) OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()-Point*115,OrderTakeProfit(),0,Blue); if((Bid(OrderOpenPrice()-Point*135))) OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()-Point*135,OrderTakeProfit(),0,Blue); if((Bid(OrderOpenPrice()-Point*155))) OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()-Point*155,OrderTakeProfit(),0,Blue); if((Bid(OrderOpenPrice()-Point*175))) OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()-Point*175,OrderTakeProfit(),0,Blue); if((Bid(OrderOpenPrice()-Point*195))) OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()-Point*195,OrderTakeProfit(),0,Blue); if((Bid(OrderOpenPrice()-Point*210))) OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()-Point*210,OrderTakeProfit(),0,Blue); if((Bid(OrderOpenPrice()-Point*230))) OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()-Point*230,OrderTakeProfit(),0,Blue); if((Bid(OrderOpenPrice()-Point*250))) OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()-Point*250,OrderTakeProfit(),0,Blue); } } //+------------------------------------------------------------------+