Hi - Calculate PERIOD_M15 ?

 

Hi There;

I have a need to calculate 3 bars in M15 range. the last 3 bars including the current bar to make it comfortable.

I do not want to rely on Chart component as the user will change the M15 to other ranges periodically and it's part of the automated process.


The purpose of the requirement is to place a buy or sell position depending on the given data rates.


For Example:

07:00:00; Bid 1600; Ask 1590

07:00:00; Bid 1580; Ask 1570

07:00:00; Bid 1620; Ask 1610


The calculation I need to perform must yield a position or negative value from the current data rate. which in this example is Bid 1620; Ask 1610.

Calculated value of all the Bid combined from lowest to highest. and same for Ask.

Bid: 40 - Spike Detected ...


Any suggestions ? 

 

its unclear what you are trying to achieve, but if you want to detect when spread spikes, then use spread instead of bid and ask.

Sorry, but your description dont make sense to me. Try again to describe what you want.

 
Chris Stols: I have a need to calculate 3 bars in M15 range. the last 3 bars including the current bar to make it comfortable.

Until you can state your needs in concrete terms, it can not be coded.

 

why cant you specify the timeframe in your code? like so... iClose(NULL,PERIOD_M15,blah) and if you need the ask prices, then add spread to that price.

to use highest and lowest of your prices, there is a lot of posts how to do this on this website.