I don't understand how to use this code I got on the forum.

 

I've been struggling to find out how to find the value of the upper/lower lines of the standard deviation channel at a given time so that I can code a break above/below the channel. I found the following code on the forum and I believe someone is trying to provide the answer I'm looking for but I'm still really new to coding. I was hoping someone with more experience could help me understand what I'm looking at and how to apply it so that it can be useful to me for my purposes. I will really appreciate any help. Thanks in advance.

#property copyright "Example Script"
#property strict

void OnStart()

{
Alert("");

//Simple example of drawing the standard deviation channel
ObjectCreate("Channel",OBJ_STDDEVCHANNEL,0,Time[33],0,Time[11],0); //draw the standard deviation channel
ObjectSetDouble(Symbol(),"Channel",OBJPROP_DEVIATION,0.75); //change the deviation size of the channel
ObjectSetInteger(Symbol(),"Channel",OBJPROP_COLOR,clrBlue); //change the colour
ObjectSetInteger(Symbol(),"Channel",OBJPROP_RAY_RIGHT,TRUE); //enable the ray right

// Below is the code I pulled off the forum. It is supposed to find the value of the line of the standard
// deviation channel so that I can code the cross of that line. I'm not sure what I'm looking at. I'm not
// sure how to use this.

   double pr1 = ObjectGetDouble(0,"Channel",OBJPROP_PRICE1);
   double pr2 = ObjectGetDouble(0,"Channel",OBJPROP_PRICE2);
//                        +
   int ba1 = iBarShift(Symbol(),PERIOD_CURRENT,ObjectGetInteger(0,"Channel",OBJPROP_TIME1));
   pr1 = ObjectGetValueByShift("Channel",ba1);

Alert("Price 2 is ", pr2);
Alert("Price 1 is ", pr1);

}
 
dasilvja:

I've been struggling to find out how to find the value of the upper/lower lines of the standard deviation channel at a given time so that I can code a break above/below the channel. I found the following code on the forum and I believe someone is trying to provide the answer I'm looking for but I'm still really new to coding. I was hoping someone with more experience could help me understand what I'm looking at and how to apply it so that it can be useful to me for my purposes. I will really appreciate any help. Thanks in advance.


You have to use the iBands

Calculates the Bollinger Bands® indicator and returns its value.

double  iBands(
   string       symbol,           // symbol
   int          timeframe,        // timeframe
   int          period,           // averaging period
   double       deviation,        // standard deviations
   int          bands_shift,      // bands shift
   int          applied_price,    // applied price
   int          mode,             // line index
   int          shift             // shift
   );

 
ffoorr:

You have to use the iBands

Calculates the Bollinger Bands® indicator and returns its value.

double  iBands(
   string       symbol,           // symbol
   int          timeframe,        // timeframe
   int          period,           // averaging period
   double       deviation,        // standard deviations
   int          bands_shift,      // bands shift
   int          applied_price,    // applied price
   int          mode,             // line index
   int          shift             // shift
   );

I don't understand. Standard deviation channel uses straight lines and Bollinger Bands change on every new candle. Could you elaborate? 
 
dasilvja:
I don't understand. Standard deviation channel uses straight lines and Bollinger Bands change on every new candle. Could you elaborate? 
. " Standard deviation channel uses straight lines ... Could you elaborate? "


can you show an image of " Standard deviation channel using straight lines "  So that we know what you are talking about ?


standard deviation channel or iBands or Bollinger Bands are the same stuff,

So we cannot know what you are talking about

 
ffoorr:
. " Standard deviation channel uses straight lines ... Could you elaborate? "


can you show an image of " Standard deviation channel using straight lines "  So that we know what you are talking about ?


standard deviation channel or iBands or Bollinger Bands are the same stuff,

So we cannot know what you are talking about

Standard Deviation Channel. I said that every time but for some reason "channel" didn't highlight.