Hi, can anyone help?
This seems a simple task but it does not work. I want to start a buy process when Ask or Bid crosses a Bollinger Band for example;
if(Ask==UpperBand) // UpperBand is the iBands fuction
{
Then if ask is equal to Upperband then open trade etc .
The problem is that the double equal == operand does not work. When Ask is equal to Upper band the code ignores this . I tried this and it works <= and this does also >= does but not ==.
I want to trade to open at precisely the point that the market crosses the band.
Yes thank you very much for your time to reply and the excellent links.
From what I understand from reading these there will be no time that the value of Ask or Bid will ever match preciously the value attributed to the variable of the iband function.
I understand now. Just got to get my head around writing code that will execute a function when those two figures are (approximately) equal and not just more or less than.
This part of my program is to generate a buy order when the market crosses the iband hoping that the market will reverse as a basic Bollinger strategy.
Should they market continue in an adverse direction I don't want that trade to be opened then stopped-out then the next trade started because the code specifies that the ea buys when the ask or put is more than the iband value.
That is why I was seeking only the precise moment the market crosses the band or when it re=crosses when it reverses direction.
Some thought
Thanks again
Chris
Yes thank you very much for your time to reply and the excellent links.
From what I understand from reading these there will be no time that the value of Ask or Bid will ever match preciously the value attributed to the variable of the iband function.
I understand now. Just got to get my head around writing code that will execute a function when those two figures are (approximately) equal and not just more or less than.
This part of my program is to generate a buy order when the market crosses the iband hoping that the market will reverse as a basic Bollinger strategy.
Should they market continue in an adverse direction I don't want that trade to be opened then stopped-out then the next trade started because the code specifies that the ea buys when the ask or put is more than the iband value.
That is why I was seeking only the precise moment the market crosses the band or when it re=crosses when it reverses direction.
Some thought
Manually what I would do is watch the chart and trade as soon as it crosses the band. If this turns to a loss I would not open another trade while the market is still rising (I am going short) What, as discussed, is not happening with my EA is that the, say, Ask is not recognized to equal the iban when that position is reached with the operand == only after with >=. ie more than the iband. Then I could take several losses on stop-loss because of the > bit.
So I will try this. Adding 0.000001 to the iband ensuring that the trade is opened very close to the band and then not above it if(Ask>=UpperBand&&Ask<=UpperrBand+0.00001) ...
regards, Chris
Manually what I would do is watch the chart and trade as soon as it crosses the band. If this turns to a loss I would not open another trade while the market is still rising (I am going short) What, as discussed, is not happening with my EA is that the, say, Ask is not recognized to equal the iban when that position is reached with the operand == only after with >=. ie more than the iband. Then I could take several losses on stop-loss because of the > bit.
So I will try this. Adding 0.000001 to the iband ensuring that the trade is opened very close to the band and then not above it if(Ask>=UpperBand&&Ask<=UpperrBand+0.00001) ...
regards, Chris
Thank you,
More thought
Chris
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi, can anyone help?
This seems a simple task but it does not work. I want to start a buy process when Ask or Bid crosses a Bollinger Band for example;
if(Ask==UpperBand) // UpperBand is the iBands fuction
{
Then if ask is equal to Upperband then open trade etc .
The problem is that the double equal == operand does not work. When Ask is equal to Upper band the code ignores this . I tried this and it works <= and this does also >= does but not ==.
I want to trade to open at precisely the point that the market crosses the band.
Many thanks for any possible answers
Chris