Compare four or more candlesticks

Created at 26 Jun 2014, 17:15
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!
Forex19's avatar

Forex19

Joined 13.06.2013

Compare four or more candlesticks
26 Jun 2014, 17:15


Hi, 
I need to compare the closing price of four or more candlesticks. 

What is the best way?


@Forex19
Replies

breakermind
26 Jun 2014, 23:50

RE:

Forex19 said:

Hi, 
I need to compare the closing price of four or more candlesticks. 

What is the best way?

Hi,

This is one of those things whose probably can not do :D

I think you can compare only two things ;)

Bye.


@breakermind

breakermind
26 Jun 2014, 23:53

RE: RE:

Or one by one ...


@breakermind

Forex19
27 Jun 2014, 18:58

RE: RE:

breakermind said:

Forex19 said:

Hi, 
I need to compare the closing price of four or more candlesticks. 

What is the best way?

Hi,

This is one of those things whose probably can not do :D

I think you can compare only two things ;)

Bye.

Waiting to see if you get other suggestions.

How would you compare two things?


@Forex19

breakermind
27 Jun 2014, 21:10

RE: RE: RE:

Forex19 said:

breakermind said:

Forex19 said:

Hi, 
I need to compare the closing price of four or more candlesticks. 

What is the best way?

Hi,

This is one of those things whose probably can not do :D

I think you can compare only two things ;)

Bye.

Waiting to see if you get other suggestions.

How would you compare two things?

Something l;ike ...

This black car is prettier than orange one.

:D:D:D
But I meant "Strings, values ​​etc ..."

Bye.


@breakermind

breakermind
27 Jun 2014, 21:12

RE: RE: RE: RE:

If you felt offended, I did not want to offend anyone.

Bye.


@breakermind

Jimmy
29 Jun 2014, 13:27

It depends on which result you are aiming at.

You want to compare then as to end up with what exactly?

The one that is highest? or lowest? or ??

You could try the one of the Math functions first compare the first two then you get one end result then compare that with the third and what comes out of that with the fourth and so untill you are left with the result you want.

Take a look at the Heiken Ashi formula which is an excellent example.


@Jimmy

Forex19
29 Jun 2014, 18:19

RE:

Jimmy said:

You could try the one of the Math functions first compare the first two then you get one end result then compare that with the third and what comes out of that with the fourth and so untill you are left with the result you want.

How? An example please.

 

Take a look at the Heiken Ashi formula which is an excellent example.

Like this:

/algos/indicators/show/60

or other?

 


@Forex19

Jimmy
04 Jul 2014, 13:25

RE: RE:

Forex19 said:

Jimmy said:

You could try the one of the Math functions first compare the first two then you get one end result then compare that with the third and what comes out of that with the fourth and so untill you are left with the result you want.

How? An example please.

 

Take a look at the Heiken Ashi formula which is an excellent example.

Like this:

/algos/indicators/show/60

or other?

 

Yes look at the logic used.

var haClose = (open + high + low + close) / 4;
            double haOpen;
            if (index > 0)
                haOpen = (_haOpen[index - 1] + _haClose[index - 1]) / 2;
            else
                haOpen = (open + close) / 2;
 
            var haHigh = Math.Max(Math.Max(high, haOpen), haClose);
            var haLow = Math.Min(Math.Min(low, haOpen), haClose);

So once more what end result do you want ?

You have four candles what do you need to know?

Averages?

Highest?

Lowest?

You say you want to compare four candlesticks but you do not say what exactly it is you want to compare so how are we to give an answer if we do not know what end result your aiming at.

Say for example you want the highest value you then first compare the first two and you end up with the highest value of the first two, and this you compare to the third, so now you know the highest value from candle one two and three then you compare this to candle four and you are left with the one highest candle but i have no idea what you are trying to accomplish so please clarify.


@Jimmy

Forex19
04 Jul 2014, 13:48

RE: RE: RE:

Jimmy said:


 

So once more what end result do you want?

You have four candles what do you need to know?

Averages?

Highest?

Lowest?

You say you want to compare four candlesticks but you do not say what exactly it is you want to compare so how are we to give an answer if we do not know what end result your aiming at.

Say for example you want the highest value you then first compare the first two and you end up with the highest value of the first two, and this you compare to the third, so now you know the highest value from candle one two and three then you compare this to candle four and you are left with the one highest candle but i have no idea what you are trying to accomplish so please clarify.

I would be interested to compare the closing or the average of the last 4 candles and then use it in the logic for opening positions.

Thank you. I apologize if I did not specify well before I remembered to have said.

 


@Forex19

Jimmy
05 Jul 2014, 12:16

I still don't get it it must be me.

Comparing the closing and average can not be an or, you are either extracting the highest value, the lowest value, or the value average.

If you want the average you add them all up and divide them by 4 it is actually in the Heiken Ashi formula.

But in your case you use the close of the four bars instead of open high low close etc.from just one.

var haClose = (open + high + low + close) / 4;

You can also simply compare the last four bars out of the array with the multiple if statements or use the math functions to end up with the highest/lowest value.

For high something like this with Math.Max

var haHigh = Math.Max(Math.Max(high, haOpen), haClose);

Or low like this with Math.Min

var haLow = Math.Min(Math.Min(low, haOpen), haClose);

 


@Jimmy