Question: Bolinger bands

Back to topics list  | 1 2 To post a new topic, please log in or register
FMIC 2016.09.23 15:41 #
you're right:-)- see below:

Yes, there are several logic problems in your code.

  1. You never call the function "CheckVolKatan()" anywhere in your code, so how do you expect it to have any influence?
  2. In the "OpenOredrsThisPair()" (which is a mistype I think), you never test the result of OrderSelect() and just assume that it always works.
  3. In the same "OpenOredrsThisPair()", you also do not check for your magic number, so the order count will be incorrect.
  4. Your IsNewCandle() is unreliable. You should not use Bars to check for a New Candle. It is a very old and a unreliable technique. Use the following instead:
    bool IsNewCandle()
       static datetime last_time = WRONG_VALUE;
       datetime lastbar_time = (datetime) SeriesInfoInteger( _Symbol, _Period, SERIES_LASTBAR_DATE ); // to be compatible with MQL5
       if( last_time != WRONG_VALUE )
          if( last_time != lastbar_time )
             last_time = lastbar_time;
             return( true );
          last_time = lastbar_time;
       return( false );
WHRoeder 2016.09.23 16:34 #
  1. Bars is unreliable (a refresh/reconnect can change number of bars on chart) volume is unreliable (miss ticks) Always use time. New candle - MQL4 forum
  2. I disagree with make a new bar function, because it can only be called once per tick. A variable can be tested multiple times.
steve_o 2016.09.23 17:21 #

All- thanks very much for your assistance and Important comments!

much appreciated!!!


Back to topics list   | 1 2  

To add comments, please log in or register