//+------------------------------------------------------------------+ //| CustomRectangle.mq4 | //| Kalenzo | //| http://www.fxservice.eu | //+------------------------------------------------------------------+ #property copyright "Kalenzo" #property link "http://www.fxservice.eu" #property indicator_chart_window //---- input parameters extern int candleShift = 5; extern string rectangleName = "REC1";//needs to be unique extern int iPrice = 3;// 0 - open, 1- high, 2-low, 3-close extern bool useColors = true; extern color defaultColor = DodgerBlue; extern color upColor = Green; extern color dnColor = Red; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { //---- ObjectDelete(rectangleName); ObjectCreate(rectangleName, OBJ_RECTANGLE, 0, Time[candleShift], getPrice(iPrice,candleShift),Time[0], getPrice(iPrice,0)); ObjectSet(rectangleName, OBJPROP_WIDTH, 2); if(useColors) { if(Close[candleShift]>Close[0]) ObjectSet(rectangleName, OBJPROP_COLOR, dnColor); else ObjectSet(rectangleName, OBJPROP_COLOR, upColor); } else { ObjectSet(rectangleName, OBJPROP_COLOR, defaultColor); } //---- return(0); } //+------------------------------------------------------------------+ double getPrice(int type,int x) { switch(type) { case 0: return(Open[x]); case 1: return(High[x]); case 2: return(Low[x]); case 3: return(Close[x]); default : return(Close[x]); } }
Sample
Analysis
Market Information Used:
Series array that contains open time of each bar
Series array that contains close prices for each bar
Series array that contains open prices of each bar
Series array that contains the highest prices of each bar
Series array that contains the lowest prices of each bar
Indicator Curves created:
Indicators Used:
Custom Indicators Used:
Order Management characteristics:
Other Features: