Jump to content

cUStOM InDicatoR


4xmeter

Recommended Posts

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]);

}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...