Need support on Candle body

Created at 15 Feb 2017, 09:17
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!
HI

hiba7rain

Joined 20.07.2014

Need support on Candle body
15 Feb 2017, 09:17


how to code body of a candle as percentage of the candle it self between the high and low of the same and use it in a cbot to do an action

for example to say if body = or greater than x% of candle do this


@hiba7rain
Replies

whis.gg
16 Feb 2017, 15:54

int index = MarketSeries.Open.Count - 1;

double candleSize = MarketSeries.High[index] - MarketSeries.Low[index];
double bodySize = Math.Abs(MarketSeries.Open[index] - MarketSeries.Close[index]);
            
double percent = bodySize * 100 / candleSize;

if (percent > 50)
{
    // the body size is greater than 50% of the candle
}

You mean like that?


@whis.gg