//+------------------------------------------------------------------+ //| disketmadu_LINES.mq4 | //+------------------------------------------------------------------+ #property copyright "By cja" #property indicator_chart_window extern int GMTshift=0; extern bool Show_Line_Labels = true; extern string IIIIIIIIIIIIIIII="<<< Open Lines >>>>>"; extern int BUY_Area =50; extern int SELL_Area = 50; extern int BUY2_Area =100; extern int SELL2_Area = 100; #define Open. "Open." extern color Open_Color = Silver; extern int Open_width = 2; extern int Open_Line_Type = 0; #define BUY1 "BUY1" extern color BUY1_Color = Blue; extern int BUY1_width = 1; extern int BUY1_Line_Type = 0; #define SELL1 "SELL1" extern color SELL1_Color = Red; extern int SELL1_width = 1; extern int SELL1_Line_Type = 0; #define BUY2 "BUY2" extern color BUY2_Color = RoyalBlue; extern int BUY2_width = 1; extern int BUY2_Line_Type = 0; #define SELL2 "SELL2" extern color SELL2_Color = Tomato; extern int SELL2_width = 1; extern int SELL2_Line_Type = 0; double P, S1, B1, S2, B2, S3, B3; double day_high; double day_low; double yesterday_open; double today_open; double cur_day; double prev_day; double yesterday_high=0; double yesterday_low=0; double yesterday_close=0; double tmp=0; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators IndicatorShortName("disketmadu_LINES"); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- ObjectsDeleteAll(0,OBJ_TRENDBYANGLE); ObjectDelete("Open_Label"); ObjectDelete("Buy_Label_Open");ObjectDelete("Buy2_Label_Open"); ObjectDelete("Sell_Label_Open");ObjectDelete("Sell2_Label_Open"); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int counted_bars= IndicatorCounted(); //---- CreatePVT(); } void CreateLine(string Line, double start, double end,double w, double s,color clr) { ObjectCreate(Line, OBJ_TRENDBYANGLE, 0, iTime(NULL,1440,0)+GMTshift*3600, start, Time[0],w,s, end); ObjectSet(Line, OBJPROP_COLOR, clr); ObjectSet(Line,OBJPROP_RAY,false); ObjectSet(Line,OBJPROP_WIDTH,w); ObjectSet(Line,OBJPROP_STYLE,s); } void DeleteLine() { ObjectDelete(BUY1); ObjectDelete(SELL1);ObjectDelete(Open.); ObjectDelete(BUY2); ObjectDelete(SELL2); } void CreatePVT() { DeleteLine(); double day_high=iHigh(NULL,1440,0); double day_low=iLow(NULL,1440,0); double yesterday_open=iOpen(NULL,1440,1); double today_open=iOpen(NULL,1440,0); double yesterday_high = iHigh(NULL,1440,1); double yesterday_low = iLow(NULL,1440,1); double yesterday_close = iClose(NULL,1440,1); cur_day=0; prev_day=0; int cnt=720; while (cnt!= 0) { if (TimeDayOfWeek(Time[cnt]) == 0) { cur_day = prev_day; } else { cur_day = TimeDay(Time[cnt]-(GMTshift*3600)); } if (prev_day != cur_day) { yesterday_close = Close[cnt+1]; today_open = Open[cnt]; yesterday_high = iHigh(NULL,1440,1); yesterday_low = iLow(NULL,1440,1); day_high = High[cnt]; day_low = Low[cnt]; prev_day = cur_day; } if (High[cnt]>day_high) { day_high = High[cnt]; } if (Low[cnt]