setting the properties of the OBJ_STDDEVCHANNEL

 
Hi
can one Get/Set the properties of the OBJ_STDDEVCHANNEL in the code?
if so, please show an example or hint.

where do I find the code for the above object?

many thanks
 
 
Rosh
try this
ObjectCreate("chn1", OBJ_STDDEVCHANNEL, 0, Time[10],0, Time[0],0);
Comment(ObjectGet("chn1", OBJPROP_FIRSTLEVEL+0)); //prints 0
Comment(ObjectGet("chn1", OBJPROP_FIRSTLEVEL+1)); //prints 0
Comment(ObjectGet("chn1", OBJPROP_FIRSTLEVEL+2)); //prints 0

what am I missing?
I want to get the upper/lower bounds. I think I have to approch it differently. i.e by creating a regression line and do my own low level math stuff.

thanks
 
The properties OBJPROP_FIRSTLEVEL0, OBJPROP_FIRSTLEVEL1(without "+") and etc are only for Fibonacci objects. Sure, you "have to approch it differently. i.e by creating a regression line and do my own low level math stuff" in your matter.
 
Sure, you "have to approch it differently. i.e by creating a regression line and do my own low level math stuff" in your matter.

That's what I told him, so he started a new thread. Didn't like that answer.
 
Comment(ObjectGetValueByShift("chn1",0));
Comment(ObjectGetValueByShift("chn1",1));
Comment(ObjectGetValueByShift("chn1",2));
Comment(ObjectGetValueByShift("chn1",3));

all print 0.
I read about a bug that apparently has not been fixed till now "build 209".
if I get the above values, I can use the value of the standard deviation parameter to calculate the upper/lower channel values. "apporox".
 
Well, here is what I come up with for a code sample for you.

run this script on a chart, it gives a yellow StdDeviation channel, and overlays the default channel lines with red trendlines.

Move the channel around, the trendlines follow, it finds the value of the upper channel at the highest price in the channel and marks it and the highest price with a little arrow.


//+------------------------------------------------------------------+
//|                                       Test_Deviation_Channel.mq4 |
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+
int start()
  {

	ObjectDelete("DEV");
	ObjectCreate("DEV", OBJ_STDDEVCHANNEL, 0, Time[100], 0, Time[0], 0);
	ObjectSet	("DEV", OBJPROP_COLOR, Yellow);
	while(!IsStopped()){
	
	int period = iBarShift(Symbol(), 0, ObjectGet("DEV", OBJPROP_TIME1)) - iBarShift(Symbol(), 0, ObjectGet("DEV", OBJPROP_TIME2));
	
	double deviation = iStdDev(Symbol(), 0, period, 0, 0, 0, iBarShift(Symbol(), 0, ObjectGet("DEV", OBJPROP_TIME2)));
	
	ObjectDelete("UL");
	ObjectCreate("UL", OBJ_TREND, 0, Time[iBarShift(Symbol(), 0, ObjectGet("DEV", OBJPROP_TIME1))], ObjectGet("DEV", OBJPROP_PRICE1)+ deviation, Time[iBarShift(Symbol(), 0, ObjectGet("DEV", OBJPROP_TIME2))], ObjectGet("DEV", OBJPROP_PRICE2)+ deviation);
	ObjectDelete("LL");
	ObjectCreate("LL", OBJ_TREND, 0, Time[iBarShift(Symbol(), 0, ObjectGet("DEV", OBJPROP_TIME1))], ObjectGet("DEV", OBJPROP_PRICE1)- deviation, Time[iBarShift(Symbol(), 0, ObjectGet("DEV", OBJPROP_TIME2))], ObjectGet("DEV", OBJPROP_PRICE2)- deviation);


	int 		HighBar 		= iHighest(Symbol(), 0, MODE_HIGH, period, iBarShift(Symbol(), 0, ObjectGet("DEV", OBJPROP_TIME2)));
	double 	HighPrice 	= High[HighBar];
	double	UpperDevLinePrice = ObjectGetValueByShift("UL", HighBar);
	
	
	ObjectDelete("DevArrow");
	ObjectCreate("DevArrow",  OBJ_ARROW, 0, Time[HighBar], UpperDevLinePrice, 0, 0);
	ObjectSet("DevArrow", OBJPROP_ARROWCODE, 2);
	ObjectDelete("HighArrow");
	ObjectCreate("HighArrow", OBJ_ARROW, 0, Time[HighBar], HighPrice, 0, 0);
	ObjectSet("HighArrow", OBJPROP_ARROWCODE, 2);
	
	Comment(	"Time 1 = "+ ObjectGet("DEV", OBJPROP_TIME1)+"\n"+
				"Time 2 = "+ ObjectGet("DEV", OBJPROP_TIME2)+"\n"+
				"Price1 = "+ ObjectGet("DEV", OBJPROP_PRICE1)+"\n"+
				"Price2 = "+ ObjectGet("DEV", OBJPROP_PRICE2)+"\n"+
				"Highest Price during Channel "+ HighPrice+"\n"+
				"Upper Channel Price at Highest Price =  "+ UpperDevLinePrice+"\n"
				);
	Sleep(32);
	}
   return(0);
  }


Reason: