4xmeter Posted August 2, 2010 Report Share Posted August 2, 2010 cUSTOM rECTANgLE #property copyright "Kalenzo" #property link "http://www.fxservice.eu" #property indicator_chart_window extern int candleShift = 11; extern string rectangleName = "REC1"; extern int iPrice = 3; extern bool useColors = TRUE; extern color defaultColor = DodgerBlue; extern color upColor = Green; extern color dnColor = Red; int init() { return (0); } int deinit() { return (0); } 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 ai_0, int ai_4) { switch (ai_0) { case 0: return (Open[ai_4]); case 1: return (High[ai_4]); case 2: return (Low[ai_4]); case 3: return (Close[ai_4]); } return (Close[ai_4]); } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.