help on a code

 

Hello Everyone,


I am dummy at programming. I want a simple calculation but do not know how to program it.

I want to get standard deviation for last two candles on any timeframe but do not understand how to write this code or how to do it.

if someone could help me on how do i get standard deviation for following values:
Current Candle - Open, High, Low, Close

Previous Candle - Open, High, Low, Close

I need standard deviation of these eight values mentioned above.


Thanks in advance.

 
iStdDev does not have OHLC parameters, you can get for last two candle by adding ma_shift as 0 for current candle and 1 for previous candle
/*
int   iStdDev ( 
   string               symbol,             // symbol name  
   ENUM_TIMEFRAMES      period,             // period  
   int                  ma_period,          // averaging period  
   int                  ma_shift,           // horizontal shift  
   ENUM_MA_METHOD       ma_method,          // smoothing type  
   ENUM_APPLIED_PRICE   applied_price       // type of price or handle  
   ); 
*/
//Example
int  iStdDev =  iStdDev ( NULL , PERIOD_M1 , 1 , 1 , MODE_SMA , PRICE_CLOSE ); 
Print ( iStdDev ); 
Reason: