Aggregate of x bars

Created at 09 Nov 2015, 21:59
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
IR

iRobot

Joined 17.02.2013

Aggregate of x bars
09 Nov 2015, 21:59


I need to calculate aggregate values on candle heights for the last x periods.

How to do that with:

a) Functions.Sum()

b) for loop ?

 

Thanks


@iRobot
Replies

Spotware
10 Nov 2015, 15:40

Dear Trader,

You can sum up the values of the bars using several approaches. One approach is to write a for loop which will decrease the number of periods and by using the Last method you can retrieve the values you want. Then, you could sum up these values in a variable. 


@Spotware