EA is not picking up the period I am using

 

Hi Everyone,

This is my first forum post so apologies if my question is vague and/or explained incorrectly.

I have a bollinger band strategy that has a int period of over 1100 in the iBands (weird I know, just work with me here) 


double bbMid03  = iBands(NULL,0,1100,bbStd03,0,PRICE_CLOSE,0,0);



Each time I start the expert Advisor however it always opens a trade at the start of the modelling timeframe and will close that same trade at the end of the modelling timeframe. So only 1 trade can happen in a timeframe of 1 year!

However, whenever the  int period is less than 1100 multiple trades open and close within the modelling timeframe.


double bbMid03  = iBands(NULL,0,500,bbStd03,0,PRICE_CLOSE,0,0);



Any explanation as to why this is happening will be appreciated, and even more so how to overcome this issue. Regards

 
Mayowa Olufeko:

Hi Everyone,

This is my first forum post so apologies if my question is vague and/or explained incorrectly.

I have a bollinger band strategy that has a int period of over 1100 in the iBands (weird I know, just work with me here) 


double bbMid03  = iBands(NULL,0,1100,bbStd03,0,PRICE_CLOSE,0,0);



Each time I start the expert Advisor however it always opens a trade at the start of the modelling timeframe and will close that same trade at the end of the modelling timeframe. So only 1 trade can happen in a timeframe of 1 year!

However, whenever the  int period is less than 1100 multiple trades open and close within the modelling timeframe.


double bbMid03  = iBands(NULL,0,500,bbStd03,0,PRICE_CLOSE,0,0);



Any explanation as to why this is happening will be appreciated, and even more so how to overcome this issue. Regards

What is the tested timeframe and

have you got any deflective provisions regarding the bollingerBands period in the code ? 

[also i dont know if the bands function will straight up reject the request if there are not enough bars in the chart in the tester,will need to check the return value there]

 
Lorentzos Roussos:

What is the tested timeframe and

have you got any deflective provisions regarding the bollingerBands period in the code ? 

[also i dont know if the bands function will straight up reject the request if there are not enough bars in the chart in the tester,will need to check the return value there]

Hi Lorentzos,


The tested timeframe is across any. from 7 days to 2 years, the same issues arise

No deflective provisions as right now as I am just editing the period in the code and then testing

Ah, this may be the problem! I guess I will need to find out what the maximum number of bars in a chart is

 
2OT 3OT:

Hi Lorentzos,


The tested timeframe is across any. from 7 days to 2 years, the same issues arise

No deflective provisions as right now as I am just editing the period in the code and then testing

Ah, this may be the problem! I guess I will need to find out what the maximum number of bars in a chart is

Yeah , i havent tested that ever either .Let me know what it returns .thanks

 
  1. Why did you post your MT4 question in the MT5 EA section instead of the MQL4 section, (bottom of the Root page?)
              General rules and best pratices of the Forum. - General - MQL5 programming forum?
    Next time post in the correct place. The moderators will likely move this thread there soon.

  2. double bbMid03  = iBands(NULL,0,1100,bbStd03,0,PRICE_CLOSE,0,0);
    You don't have a MA or bands until you have 1100 bars (past your shift (of zero)). You are reading garbage. The tester starts with only 100 bars (IIRC) before the start date.
 
William Roeder:
  1. Why did you post your MT4 question in the MT5 EA section instead of the MQL4 section, (bottom of the Root page?)
              General rules and best pratices of the Forum. - General - MQL5 programming forum?
    Next time post in the correct place. The moderators will likely move this thread there soon.

  2. You don't have a MA or bands until you have 1100 bars. You are reading garbage. The tester starts with only 100 bars (IIRC) before the start date.

1. Thanks for the advice, I will move it onto the mt4 thread shortly

2. Sorry, please explain in more detail. What do you mean I am reading garbage? Are you saying the tester cannot capture up to 1100 bars?

Thank you

 
2OT 3OT: What do you mean I am reading garbage?
  1. How can you generate a 1100 bar moving average and a 1100 bar standard deviation when you don't have 1100 bars initially?
  2. Once you've tested through the initial 1000 bars, then and only then can you use iBands and get a valid value.
  3. What part of "The moderators will likely move this thread there soon" was unclear?
  4. Don't double post! You already had this thread open.
              General rules and best pratices of the Forum. - General - MQL5 programming forum 2017.07.19

 
William Roeder:
  1. How can you generate a 1100 bar moving average and a 1100 bar standard deviation when you don't have 1100 bars initially?
  2. Once you've tested through the initial 1000 bars, then and only then can you use iBands and get a valid value.
  3. What part of "The moderators will likely move this thread there soon" was unclear?
  4. Don't double post! You already had this thread open.
              General rules and best pratices of the Forum. - General - MQL5 programming forum 2017.07.19

3&4. Thanks for the explanation I understand now.

1. So my only question is how can I get the 1100 bars initially to use iBands to get a value value?

Thank you

 
2OT 3OT: 1. So my only question is how can I get the 1100 bars initially to use iBands to get a value value?

You don't. #4.2 & #6.2 Test if you have 1100 bars.

 
William Roeder:

You don't. #4.2 & #6.2 Test if you have 1100 bars.

I think I am starting to grasp what you are you saying. Relating to #4.2 I have to use the shift period of -1100? to test through the initial bars?
 
2OT 3OT: I have to use the shift period of -1100? to test through the initial bars?

NO! NO! NO! You can not read the future. You can not read the nonexistent past. Stop trying! Deal with it!

If you do not have enough, return until you do.

What part of "Once you've tested through the initial 1000 bars, then and only then can you use iBands and get a valid value" is unclear to you?

What part of "Test if you have 1100 bars" is unclear to you?

Reason: