Changing colors using #property indicator_color1 and indicator buffer on property sheet

 
Hello.

I am a experienced database programmer (14 years self-employed developing custom database applications) but no experience in any C++ like language.

I'm trying to use the indicator buffers in the property sheet to allow the user to change the colors of horizontal lines that are created by the indicator. I've been able to trap for when to delete and recreate the objects because the init gets fired again if the user goes into the property sheet and changes anything.

the problem is I have no idea how to capture the new values that the user changes. It seems that what I have in the init here does not work. It appears that if the user changes the color of the buffer in the indicators property sheet that it does not change the value of indicator_color1.

I've tried many different scenarios over several hours trying to figure this out.

Please help. Is this possible? What is the value/variable that is changed when the user changes the color of an indicator buffer on the property sheet?

This is a stripped down sample of code to indicate the approach I'm using.

Thank you so very much in advance for your assistance.

//--------------------------------
#property indicator_buffers 4
#property indicator_color1 Green
#property indicator_width1 1
#property indicator_style1 STYLE_DASHDOTDOT

color PivotColor=indicator_color1;
int PivotStyle=indicator_style1;
bool initFired=false;

//--------------------------------
int init()
{
initFired=true;
myLineColor=indicator_color1;
myLineStyle=indicator_style1;
}
//--------------------------------

//--------------------------------
int start()
{
if(initFired)
{
ObjectDelete("PV");

ObjectCreate("PV",OBJ_HLINE,0,0,1.900);
ObjectSet("PV",OBJPROP_COLOR,myColor);
ObjectSet("PV",OBJPROP_STYLE,myStyle);
ObjectSetText("PV","Pivot(D)",6,"Arial",myColor);
initFired=false;
}
}
 
I also hope so. The "indicator_color1" should change to the new value which the user set in the property sheet , then user can use the new value in the scripts.
 
indicator_color1 is just macro-substitution, therefore it is constant and should not be changed
 
indicator_color1 is just macro-substitution, therefore it is constant and should not be changed


Slawa,

Thank you for your answer, but the bottom line of the question is, when the user goes into INDICATOR LIST, selects the indicator and clicks EDIT, clicks on the COLORS tab then changes a color and line style, then clicks OK, then clicks CLOSE, the init of the indicator executes again, but HOW DO I CAPTURE THE CHANGED VALUES IN MY PROGRAM???

This works with other indicators so there is something I dont understand.

Thank you very much,
 
HOW DO I CAPTURE THE CHANGED VALUES IN MY PROGRAM???

No way
 
HOW DO I CAPTURE THE CHANGED VALUES IN MY PROGRAM???

No way


Thanks again for your quick reply. I don't understand how programmed indicators CAN capture the change but the program code cannot -- but I trust you when you say it cannot be done :)

So, my final question on this thread is:

The indicator properties are seen by the user in a very nice way: Color, line style, and line thickness, all in one row. Very nice. Is there a way that I can have this display to users for external variables? For example, if I use:

extern color indicator_color1=MediumAquamarine;
extern int indicator_width1=1;
extern int indicator_style1=STYLE_DASHDOTDOT;

Then there are three different parameter lines, and the user is allowed to input 1000 for style which should not be allowed. I would like a one line parameter just like the 8 indicator lines on the COLORS tab. Also similar to what you see as the STYLE parameter in the PARAMETERS tab of your Moving Averages indicator.

Is there a way to do this?

Thanks again for your time and help!
 

extern color indicator_color1=MediumAquamarine;
extern int indicator_width1=1;
extern int indicator_style1=STYLE_DASHDOTDOT;

It should be different names, because abowe listed names are reserved words. For example
extern color IndicatorColor1=MediumAquamarine;
extern int IndicatorWidth1=1;
extern int IndicatorStyle1=STYLE_DASHDOTDOT;
Reason: