Download MetaTrader 5

price history calculation

To add comments, please log in or register
Dirk
62
Dirk  

Hi Guys,


I want to take an historical price[X] then divide that with the price one day prior to that historical price[X-1]

Then multiply factor that with another set price.

So:

Xfactor= historical price [X] / historical price [X-1]


Price = Xfactor * set price.


Then I want to project that price on the Main Chart.

What would be an elegant way to do that?

Ubzen
5394
Ubzen  
Ilovepippin:

Hi Guys,


I want to take an historical price[X] then divide that with the price one day prior to that historical price[X-1]

Then multiply factor that with another set price.

So:

Xfactor= historical price [X] / historical price [X-1]


Price = Xfactor * set price.


Then I want to project that price on the Main Chart.

What would be an elegant way to do that?


Do you know how to program indicators or objects?
Dirk
62
Dirk  

Simple ones yes.

whroeder1
15082
whroeder1  
  1. Then do it. 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. price one day prior to that historical price[X-1]
    prior price is price[x+1]
Dirk
62
Dirk  

Thanks for your reply WHRoeder.

I don't want anyone to code this for me, I have most of the indicator but am kind of hesitant to post it in the SRC.

I am looking for the function that does the described on a range of dates.

So: X = iClose[0] / iClose[-1]

But they have to be the close of a range of dates, say from 1/1/1996 to 1/6/1996

Then the plotted value Pv will be:

Pv = X * iClose

Where iClose is the latest (current) iClose.

My problem is to get the repetition for the iClose range. I can get it for one instance but not a range of historic prices.

Thanks.

To add comments, please log in or register