mothlymedian,weeklymedian - page 2

 
double YesterdayMedian = iMA(NULL, 0, PERIOD_D1, 0, MODE_SMMA, PRICE_MEDIAN, 1);
 
ankitkalindi:
double YesterdayMedian = iMA(NULL, 0, PERIOD_D1, 0, MODE_SMMA, PRICE_MEDIAN, 1);

now we gonna check (it is wrong, but you have to find out / see what you do )

double iMAstring symbol, int timeframe, int period, int ma_shift, int ma_method, int applied_price, int shift)

iMA is the function we use to calculate the moving average for the bar we want to know

it needs several inputs you see here as

 string symbol, int timeframe, int period, int ma_shift, int ma_method, int applied_price, int shift

//-------------

//-------------

symbol - Symbol the data of which should be used to calculate indicator. NULL means the current symbol.

the first inputtype is type string and symbol stands for the currency we want to have calculated

that can be one of the symbols you find at Market Watch (Ctrl + M) like "EURUSD" use " " for making it clear it is a string

if you use the chartsymbol then you can also use NULL or Symbol() where we like the most to see Symbol()

So for GBPUSD calculation on EURUSD chart we do

double YesterdayMedian = iMA("GBPUSD",..............................);

and for chart your program is attached you can do

double YesterdayMedian = iMA(Symbol(),..............................);

//--------------

timeframe - Timeframe. It can be any of Timeframe enumeration values. 0 means the current chart timeframe.

the second inputtype is type int (integer a number input)

Click on this link Timeframe enumeration

you see what inputs we can use for our second input

in your calculation

double YesterdayMedian = iMA(NULL, 0, PERIOD_D1, 0, MODE_SMMA, PRICE_MEDIAN, 1);

you are using 0 means if we on 1H chart you calculate the price_median over the count of hours you have chosen in the third input

we want to know not the hour not the minute not .....

only the price_median for a daily_period SO second input has to be............ ( ANSWER THIS QUESTION I REFUSE GIVING YOU MORE HELP IF YOU DON'T )

//------------------------

period - Averaging period for calculation.

the third inputtype is also int and here you have to give the number of bars you do the calculation on

You have chosen here PERIOD_D1 if you have clicked Timeframe enumeration then you know what input you have given....

it's a wrong input for one day calculation

//----------------------

ma_shift - MA shift. Indicators line offset relate to the chart by timeframe.

the fourth input

what does it mean if the input is here

5 that means .............................

-3 that means ............................

0 and 0 means ...................... Also here ANSWER

//-----------------------

ma_method - MA method. It can be any of the Moving Average method enumeration value.

the fith input see what you can use by clicking the link Moving Average method enumeration

if i wanted the average price_median of 10 days then the different methods you find in the link will give you different lines on chart

so did you had to choose for MODE_SMMA for calculate a daily price_median on a daily chart ??..............

what would be a better choice what is smooth mean ??

//--------- last inputs

applied_price - Applied price. It can be any of Applied price enumeration values.
shift - Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago).


Click on Applied price enumeration to see description different constant

//================================

Do a new attempt make it correct

double YesterdayMedian = iMA(..what do you have to write here for getting YesterdayMedian..);

you can check yourself with

Print ( "YesterdayMedian  =  ",YesterdayMedian);

do also with high of the day and low of the day

and see if ( high+low) /2 == YesterdayMedian

 
double YesterdayMedian = iMA(NULL, PERIOD_D1,1, 0, MODE_SMA, PRICE_MEDIAN, 1);
 

learn how to use iMA .... and other indicators

put the indicator on a chart and try to calculate the values you get if you open Data Window (Ctrl + D)

you can only program your own code if you understand the formula you are using

//--------

ma_shift-MA shift. Indicators line offset relate to the chart by timeframe.

the fourth input

what does it mean if the input is here

5 that means .............................

-3 that means ............................

0 and 0 means ...................... Also here ANSWER

Reason: