View Single Post
  #2 (permalink)  
Old 12-09-2005, 09:26 PM
keris2112's Avatar
keris2112 keris2112 is offline
Senior Member
 
Join Date: Dec 2005
Location: California, US
Posts: 129
keris2112 is on a distinguished road
Here's an example of the code I used to modify the colors in the shi_channel indicator. The channel color was green all the time. I modified it so that depending on if it was an up or down sloping channel, the color would either be green or red.

Take a look at the IF statement to see how I did it....

Code:
ObjectCreate("TL1",OBJ_TREND,0,T2,PP+Step*AB,T1,PP);
// Channel is Green if width is greater than ChannelAlert (Default 50),
// otherwise it is Red
if(ChannelWidth >= ChannelAlert) {ObjectSet("TL1",OBJPROP_COLOR,Lime);}
else {ObjectSet("TL1",OBJPROP_COLOR,Red); }
ObjectSet("TL1",OBJPROP_WIDTH,2); 
ObjectSet("TL1",OBJPROP_STYLE,STYLE_SOLID);
All you need to do is create an IF statement, and based on the outcome of the IF statement, the OBJPROP_COLOR will be set to this or that color.

Hope that helps.

Keris
Reply With Quote