Candle body size
Candle body size
13 Feb 2022, 08:51
Hello, please tell me how to find the size of the body of the candle.
For MT4, I do this: if(int(MathRound((Open[0] - Close[0]) / Point)) >= 70)
How to do it for cTrader, thanks
Replies
vypchela
14 Feb 2022, 10:48
( Updated at: 15 Feb 2022, 07:52 )
RE: Thanks I will try this.
amusleh said:
Hi,
In cTrader automate are available bars on your chart are inside a collection called Bars, you can access each bar with an index integer, example:
var bar = Bars[myBarIndex]; // To use Math functions you have to add using System; on top of your indicator/cBot // The .NET Math.Abs method gives you the absolute value of a number var barBodyRange = Math.Abs(bar.Open - bar.Close);
@vypchela
amusleh
15 Feb 2022, 08:29
RE: Body size equal to 10 pips
vypchela said:
Am I doing it right, I need to find the size of the body equal to 10 pips of a bearish candle var bar = Bars[1]; var barBodyRange = Math.Abs(bar.Open - bar.Close)/ Symbol.PipSize; if (barBodyRange >= 10) Thanks again.
Hi,
Yes, your calculation is correct.
The 1 bar index means the second bar on your chart from beginning, so be sure to use the correct indices when working with bars.
@amusleh
amusleh
14 Feb 2022, 08:43
Hi,
In cTrader automate are available bars on your chart are inside a collection called Bars, you can access each bar with an index integer, example:
@amusleh