/*///////////////////////////////////////////////////////////////////////// ------- PROGRAM STRUCTURE ---------- Make EA to buy at pivot point at start of day, to place pending order (any pivot point, recall from all pivots there are several shown) ////////////////////////////////////////////////////////////////////////*/ //+------------------------------------------------------------------+ //| buy_sell.mq4 | //| Copyright © 2009, MetaQuotes Software Corp. | //| http://www.metaquotes.net | //+------------------------------------------------------------------+ #property copyright "Copyright © 2009, MetaQuotes Software Corp." #property link "http://www.metaquotes.net" //+------------------------------------------------------------------+ //| expert initialization function | //+------------------------------------------------------------------+ int init() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| expert deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| expert start function | //+------------------------------------------------------------------+ int start() { //---- //double val=iCustom(NULL, 0, "PivotPoints",13,1,0); // use to show indicator from indicator directory executable file /* pivot = ( High[0] + Low[0]+ Close[0] ) / 3; Range = High[0] - Low[0]; res1 = 2 * pivot - Low[0]; res2 = pivot + Range; res3 = res2 + Range; sup1 = 2 * pivot - High[0]; sup2 = pivot - Range; sup3 = sup2 - Range;*/ double res3=iCustom(NULL, 0, "PivotPoints",0,0); double res2=iCustom(NULL, 0, "PivotPoints",1,0); double res1=iCustom(NULL, 0, "PivotPoints",2,0); double pivot=iCustom(NULL, 0, "PivotPoints",3,0); double sup1=iCustom(NULL, 0, "PivotPoints",4,0); double sup2=iCustom(NULL, 0, "PivotPoints",5,0); double sup3=iCustom(NULL, 0, "PivotPoints",6,0); int ticket; Print("sup3 ",sup3); Print("sup2 ",sup2); Print("sup1 ",sup1); Print("pivot ",pivot); Print("res3 ",res3); Print("close",Close[0]); if(Close[0]==sup3 || Close[0]==sup2 || Close[0]==sup1 || Close[0]==pivot || Close[0]==res3 || Close[0]==res1 || Close[0]==res1) { ticket=OrderSend(Symbol(),OP_BUY,1,Ask,3,Ask-25*Point,Ask+25*Point,"My order #2",16384,0,Green); if(ticket<0) { Alert("Fialed"); Print("OrderSend failed with error #",GetLastError()); return(0); } else{ Print("success ticket ID is", ticket); Comment("success ticket ID is", ticket); } } //---- return(0); } //+------------------------------------------------------------------+