need the formula of standerd deviation ....... please

 

hi all

i tried to write  my EA using Standard Deviation channel  but  i cannot  find any index  for  it's  lines only  time  points  but i need  price points


please  i  want   the  formula  and  the  equation  that  used  to  draw this  tool  on meta trader  to be able to write  my own indicator and my EA

 
I think google will give you all you need.
 

no my friend 

i already searched  for hours 

i know  the formula of  standard deviation  but  i need  the  formula or the  equation that  used  to draw this channel in  meta trader 

i want to know  how  to draw  the middle line i mean  depending on what prices  ????....... what  is the equation  of it  and  what is the equation  of the deviated  upper and lower lines  ???


if  you  could  found  such a thing  pleas  give me the link or type the equations  ...

 
batttot: i tried to write 
learn to code it, or pay someone. We're not going to code it FOR you. We are willing to HELP you when you post your attempt (using SRC) and the nature of your problem.
 

i think you didn't understand my problem 

i don't  want  any one to code  my EA ...... no sir 

i  want the equation of  specific meta trader tool called  standard deviation channel 

any way i  think this     EA  will explain the problem 

this  is EA i tried to code  and  as you see  i need  to complete  the trading conditions

now  i think my problem is  well  explained  ...........

can any one  help in this ???? 


extern int magicn = 2013;  
extern int slippage = 30;
extern double lotsize = 0.1;
 
extern double takeprofit = 20;
extern double stoploss = 50;

extern bool close_on_revers_signal =true;
extern bool Use_trailling = true;
extern double TrailingStop = 20;
 extern double USD_Profit= 100;
 
 
 int TrailingStep,TrailingProfit;
 double i;
 double pt=1;
 double x;  
 int uptrend;
 int downtrend;
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
            if (Digits == 3 || Digits == 5) pt = 10; else pt=1; 

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//----
  
 
double arrow_down   = iCustom(Symbol(),0,"arrow",0,1);
double arrow_up     = iCustom(Symbol(),0,"arrow",1,1);
 
 
double arrow_down2  = iCustom(Symbol(),0,"arrow",0,2);
double arrow_up2    = iCustom(Symbol(),0,"arrow",1,2);
  
 if( arrow_up < Low[1]&& arrow_up!=0&& arrow_up2==0  &&  IsOrderOpened() ==false && lastorderclosedbuytime() ==false)
 { uptrend=1;downtrend=0;
  
//////////////========================================================//////
//////////// here is the problem //////////////

if( Close[1]> ////standerd deviation channel upper line  ////////////
      )
   {
if(close_on_revers_signal==true)
   {
   for( int i0 =OrdersTotal();i0>=0;i0--)
   {
    OrderSelect(i0,SELECT_BY_POS,MODE_TRADES);
    if(OrderSymbol()==Symbol()&&OrderMagicNumber()==magicn  && OrderType()== OP_SELL)
     {

  
  OrderClose(OrderTicket(),lotsize,OrderClosePrice(),slippage*pt,Red);
     }
    }
   }
 
  int buyticket=OrderSend(Symbol(),OP_BUY,lotsize,Ask,slippage*pt*10,Ask-(stoploss*pt*10*Point),Ask+(takeprofit*pt*10*Point),"Batttot_EA",magicn,0,Green);
  }
 }
  if (arrow_down> High[1]&&arrow_down!=0 && arrow_down2==0 &&  IsOrderOpened() ==false && lastorderclosedselltime() ==false)
  {uptrend=0;downtrend=1;

//////////////========================================================//////
//////////// here is the problem //////////////

if( Close[1]< ////standerd deviation channel lower line  ////////////
      )
   {
    if(close_on_revers_signal==true)
    {
    for( int i3 =OrdersTotal();i3>=0;i3--)
    { 
     OrderSelect(i3,SELECT_BY_POS,MODE_TRADES);
     if(OrderSymbol()==Symbol()&&OrderMagicNumber()==magicn  && OrderType()== OP_BUY)
      {
      OrderClose(OrderTicket(),lotsize,OrderClosePrice(),slippage*10*pt,Red);
      }
     }
    }
 
   int sellticket =OrderSend(Symbol(),OP_SELL,lotsize,Bid,slippage*pt*10,Bid+(stoploss*pt*10*Point),Bid-(takeprofit*pt*10*Point),"Batttot_EA",magicn,0,Red);

  }
 if(Use_trailling == true)TrailingStopp();
//----
   return(0);
  }
 
batttot:


no my friend 

i already searched  for hours 

i know  the formula of  standard deviation  but  i need  the  formula or the  equation that  used  to draw this channel in  meta trader 

i want to know  how  to draw  the middle line i mean  depending on what prices  ????....... what  is the equation  of it  and  what is the equation  of the deviated  upper and lower lines  ???


if  you  could  found  such a thing  pleas  give me the link or type the equations  ...


??

1) I googled for "mt4 standard deviation channel" and got the source code (mq4) for download - but should not post here external links!

2) You can help yourself a lot if you just read the editor's reference e.g. for iCustom(..) (or the Book or the Documentation, links are above)

 

please ....please .........please 

read the code  again

i already read  it  many times  .

it only  call  OBJPROP_DEVIATION and drow  a line  from time  1 to time  2 and  the channel automatically drawn .  

and  there  is no prices  of  upper  and lower lines 

pleas one more time  if  you  sure that  the code you mentioned contain any information about  upper  and lower lines of  the channel 

pleas past it here 

i  already post the code of  my  EA and the problem is  obvious  in it 

so  check the code  again and  tell  me after that  if the source you  mentioned from google  will be useful or  not  !!! 

 

sigh.

I googled, for another forum and there a link of how to calc. standard deviation:

How To Calculate Standard DeviationBy sonia

First, you need to determine the mean. The mean of a list of numbers is the sum of those numbers divided by the quantity of items in the list (read: add all the numbers up and divide by how many there are).

Then, subtract the mean from every number to get the list of deviations. Create a list of these numbers. It's OK to get negative numbers here. Next, square the resulting list of numbers (read: multiply them with themselves).

Add up all of the resulting squares to get their total sum. Divide your result by one less than the number of items in the list.

To get the standard deviation, just take the square root of the resulting number

I know this sounds confusing, but just check out this example:

your list of numbers: 1, 3, 4, 6, 9, 19

mean: (1+3+4+6+9+19) / 6 = 42 / 6 = 7

list of deviations: -6, -4, -3, -1, 2, 12

squares of deviations: 36, 16, 9, 1, 4, 144

sum of deviations: 36+16+9+1+4+144 = 210

divided by one less than the number of items in the list: 210 / 5 = 42

square root of this number: square root (42) = about 6.48

This is how the standard deviation is calculated.

The indidicator standard deviation channel calculates first the linear regerssion and places above and below in the distance of the std. dev the channel.

Here you find some functions you might be able to use:  Statistics.mqh

 
  1. batttot:

    please ....please .........please 

    read the code  again

    if( Close[1]< ////standerd deviation channel lower line  ////////////
    
    I don't need to read the code again. No where in it do you try to compute the STDev. learn to code it, or pay someone. We're not going to code it FOR you. We are willing to HELP you when you post your attempt (using SRC) and the nature of your problem.
  2. gooly:

    sigh.

    I googled, for another forum and there a link of how to calc. standard deviation:

    How To Calculate Standard Deviation
    Unnecessary.
    1. Get the mean iMA - MQL4 Documentation
    2. Get the STD iStdDev - MQL4 Documentation
    3. Upper = Mean + STD Lower = Mean - STD. Done.
 
WHRoeder:
  1. batttot:

    please ....please .........please 

    read the code  again

    I don't need to read the code again. No where in it do you try to compute the STDev. learn to code it, or pay someone. We're not going to code it FOR you. We are willing to HELP you when you post your attempt (using SRC) and the nature of your problem.
  2. gooly:

    sigh.

    I googled, for another forum and there a link of how to calc. standard deviation:

    How To Calculate Standard Deviation
    Unnecessary.
    1. Get the mean iMA - MQL4 Documentation
    2. Get the STD iStdDev - MQL4 Documentation
    3. Upper = Mean + STD Lower = Mean - STD. Done.

first .. thank you for  your help

second:

this is simple EA code  to  do what you suggested

int start()
  {
//----

 
  
      double mov  =iMA(Symbol(),0, 24,0,0,0,1);  
      double std= iStdDev(Symbol(),0,24,0,0,0,1);  
      double upper= mov+std;
      double lower=mov-std;    
   
    Comment(mov,"==",upper,"==",lower);

return(0);
  }


as  you see  in the comment the  prices are  completely different from the  standard deviation  channel  tool found in  meta trader 

the  solve you suggested  only creates  channel  around moving average not  channel of  standard deviation that  found  in meta trader it self  .............

 

 
gooly:

sigh.

I googled, for another forum and there a link of how to calc. standard deviation:

How To Calculate Standard DeviationBy sonia

First,you need to determine the mean. The mean of a list of numbers is thesum of those numbers divided by the quantity of items in the list (read:add all the numbers up and divide by how many there are).

Then,subtract the mean from every number to get the list of deviations.Create a list of these numbers. It's OK to get negative numbers here.Next, square the resulting list of numbers (read: multiply them withthemselves).

Add up all of the resulting squares to get theirtotal sum. Divide your result by one less than the number of items inthe list.

To get the standard deviation, just take the square root of the resulting number

I know this sounds confusing, but just check out this example:

your list of numbers: 1, 3, 4, 6, 9, 19

mean: (1+3+4+6+9+19) / 6 = 42 / 6 = 7

list of deviations: -6, -4, -3, -1, 2, 12

squares of deviations: 36, 16, 9, 1, 4, 144

sum of deviations: 36+16+9+1+4+144 = 210

divided by one less than the number of items in the list: 210 / 5 = 42

square root of this number: square root (42) = about 6.48

This is how the standard deviation is calculated.

The indidicator standard deviation channel calculates first the linear regerssion and places above and below in the distance of the std. dev the channel.

Here you find some functions you might be able to use:  Statistics.mqh



thank you ......... thank you 


i think this will  solve it i will try this  and  came back with results 

thank you ....