MQL4 Learning - page 115

 

Thanks Christina, that was helpful

 

One more question. In the CCI indicator, the 'SHIFT' stands for what? Does it represent the current bar or does it represent a shift of those many bars?

For e.g. if shift = 100 in CCI indicator.

Then the calculations will be based on 100th bar(ahead of current bar)?

i know moving average shift on chart, i.e. we can draw a similar MA 20% above the original MA and 20% down the original MA. Is this shift and CCI shift the same?

Am not getting the meaning of that word shift

 

Shift there means bar shift, means bar 1, 2, 3... we use bar shift to identify each bar, so if we want the 100 bar before current bar, we just need to say bar 101, then the program know what bar we are talking about.

The piece of code you copied must exist in a loop, so shift will change depending on where you are at in the loop. Also here they happens to use shift to name it, but it could be any other wording, such as i, j or whatever, but because of the location of parameter, it always means bar shift regardless of what wording you use.

 

i understood it now. Thanks Christina, u got a lot of Mql4 knowledge it seems

 

Shift = Bar

For the CCI indicator and all the indicators Shift means the Bar you want to get the indicator reading at, Where the current bar = 0 and the previous bar = 1 then 2, 3 etc.

So if you want to get the reading of the CCI of current bar you use:

double cci_cur = iCCI(NULL,0,14,PRICE_CLOSE,0);[/PHP]

The CCI reading of the bar 100 is:

[PHP]double cci_100 = iCCI(NULL,0,14,PRICE_CLOSE,99);
thestockbull:
One more question. In the CCI indicator, the 'SHIFT' stands for what? Does it represent the current bar or does it represent a shift of those many bars?

For e.g. if shift = 100 in CCI indicator.

Then the calculations will be based on 100th bar(ahead of current bar)?

i know moving average shift on chart, i.e. we can draw a similar MA 20% above the original MA and 20% down the original MA. Is this shift and CCI shift the same?

Am not getting the meaning of that word shift
 
 

Thx codersguru! Got the concept perfectly now

 
 
 

how do i write a code that counts?

can someone please help me, i need a code that counts the number of EURUSD trades that I have open.

this way i can make an EA that makes a trade if the no EURUSD trades are currently open!

i will try to come up with the answer on my own too.. thnks!

edit: i decided to go with magic numbers.

total= 0;

for(int i=0;i<OrdersTotal(); i++ )

{

if(OrderSelect(i, SELECT_BY_POS)==true)

{

if (OrderMagicNumber()==12341)

total++;

}

if(total < 1)

--then a trade will be made.

Reason: