Experts: Well Martin - page 3

 
BestBroker:
bool Buy=Ask<BBLow[1] && ADX[1]<ADXLevel && (LastDealType()==0 || LastDealType()==2);
//--- Breakdown of the lower boundary of Bolinger Bands and opposite trade

bool Sell=Bid>BBUp[1] && ADX[1]<ADXLevel && (LastDealType()==0 || LastDealType()==1)

Does this mean that only a trend check is performed before entering on a BB breakdown?

i.e. if the ADX trend is bullish (+DI is higher than -DI) an entry will be made on the breakdown of the lower BB boundary, but if the ADX trend is bearish (-DI is higher than +DI) no entry will be made on the breakdown of the lower BB?

The main line(MAIN_LINE) does not count at all?

1. I have no trades open in the tester. There are no error messages in the logs. I have set the parameters as in the picture https://www.mql5.com/en/code/13315.

I'm figuring it out.

2. Based on the code:

 bool Buy=Ask<BBLow[1] && ADX[1]<ADXLevel && (LastDealType()==0 || LastDealType()==2);

There is no question of the price crossing the BB lines to enter a position at all.

Here are the conditions for a buy:

The price of the Ask instrument is below the lower BB band on the first formed bar and the value of ADX from MAIN_LINE on the first formed bar is below the value of its ADXLevel (like a flat), and the previous deal in the history was a Buy or there were no deals at all.

For sells - mirror image.

Well Martin
Well Martin
  • votes: 12
  • 2015.06.25
  • Andrew Kornishkin
  • www.mql5.com
Советник Well Martin на основе двух индикаторов: Bollinger Bands и ADX.
 

Can you tell me how to test it?

I do not open trades - the journal is clean. I have set all parameters as necessary: depo size 100 000, min lot 1, at 10 000 and min lot 0,1 - also did not test. Broker BKS. MT5. Values of external variables as on the picture from the first page. EURUSD. M15. And the test goes on OHLC on M1 since 2010. Leverage 1:100.

 
Roman Shiredchenko:

1. I have in the tester - trades are not opened. There are no error messages in the logs. I have set parameters as in the picture https://www.mql5.com/en/code/13315.

I'm figuring it out.

2. Based on the code:

There is no question of the price crossing the BB lines to enter a position at all.

Here are the conditions for a buy:

The price of the Ask instrument is below the lower BB band on the first formed bar and the value of ADX from MAIN_LINE on the first formed bar is below the value of its ADXLevel (like a flat), and the previous deal in the history was a Buy or there were no deals at all.

For sells - mirror image.

Thank you very much for the clarification!

Does not open trades based on what you said it is hard to say why, I have met many EAs that do not open trades at certain tp and sl. I have to try to go through these parameters.

I can say for sure that it is tested through the terminal of broker-Opening and demo-terminal of forex DC Alpari.

 
BestBroker:

Thank you so much for the clarification!

Does not open trades based on what you said it is hard to say why, I have met many EAs that do not open trades at certain tp and sl. It is necessary to try to search these parameters.

I can accurately say that it is tested through the terminal of the broker-Opening and demo-terminal forex DC Alpari.------------------------------------------understood thank you. I will test it on the opening terminal. It is not possible to write a normal reply from my mobile phone. the cursor keeps jumping to your post. BAG. I will write to the service desk later.











 
Roman Shiredchenko:
Contact us with any questions!
 
THANK YOU
 
Could you please add the magic number for the EA? Thank you.
 

Thanks for this tiny simple example using BB+ADX indicator.

After some improvements (and especially adding +DI, -DI), I got very good results.

Allow me to point out the "IsNewBar" function which doesn't work :

The "m_TOld" variable is not static and will always be different than "TNew".

You can replace it by that : (see: https://www.mql5.com/en/articles/22)

//+------------------------------------------------------------------+
//| Returns true if a new bar has appeared for a symbol/period pair  |
//+------------------------------------------------------------------+
bool isNewBar()
  {
//--- memorize the time of opening of the last bar in the static variable
   static datetime last_time=0;
//--- current time
   datetime lastbar_time=SeriesInfoInteger(Symbol(),Period(),SERIES_LASTBAR_DATE);

//--- if it is the first call of the function
   if(last_time==0)
     {
      //--- set the time and exit
      last_time=lastbar_time;
      return(false);
     }

//--- if the time differs
   if(last_time!=lastbar_time)
     {
      //--- memorize the time and return true
      last_time=lastbar_time;
      return(true);
     }
//--- if we passed to this line, then the bar is not new; return false
   return(false);
  }

And now there is no more problem.

Best wishes ;)

The "New Bar" Event Handler
The "New Bar" Event Handler
  • www.mql5.com
MQL5 programming language is capable of solving problems on a brand new level. Even those tasks, that already have such solutions, thanks to object oriented programming can rise to a higher level. In this article we take a specially simple example of checking new bar on a chart, that was transformed into rather powerful and versatile tool. What tool? Find out in this article.