Experts: VR Breakdown level - Trading strategy based on a breakout of the previous High or Low

 

VR Breakdown level - Trading strategy based on a breakout of the previous High or Low:

A simple trading strategy based on breakouts of prior Highs and Lows.

VR Breakdown level - Trading strategy based on a breakout of the previous High or Low

Author: Vladimir Pastushak

 

So much noise, and the code is strange in some places.

For example, the lot verification part.

// Get the minimum lot step for the symbol
  double stepvol = ::SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_STEP);
  if(stepvol > 0)
    // Calculate lot size rounded to the nearest valid step
    lt = stepvol * (int)(iLots / stepvol);
// Check if calculated lot is less than minimum allowed lot
  if(lt < ::SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_MIN))
    lt = 0.0;  // Set to 0 if below minimum (invalid)
// Return successful initialisation
  return(INIT_SUCCEEDED);
}

We got lot 0.0

Then we go to OnTick() and open a position with lot "0.0".

if(trade.Buy(lt))

This is an interesting approach, I think trading will be profitable.

--

No simple check for sufficient funds, without this check EA is scary to run even in the tester, not to mention in the demo mode

--

I don't understand the intent, why such an approach, to make it different from "like everyone else and everywhere else" --

  if(new_time != old_time)
    // Update old_time and return true (new bar detected)
    if((old_time = new_time) != NULL)
      return(true);

--

TP and SL order setting check is implemented incorrectly - if it fails, the position is left at random with zero values.



 
Vitaly Muzichenko #:

So much noise, and the code is kind of weird in some places

For example, the lot verification part

We got lot 0.0

Then go to OnTick() and open a position with lot "0.0".

Interesting approach, it will probably be profitable for trading

--

No simple check for sufficient funds, without this check EA is scary to run even in the tester, not to mention in the demo mode

--

I don't understand the intent, why such an approach, to make it different "like everyone else and everywhere else".

--

TP and SL order setting check is implemented incorrectly - if it fails, the position is left at random with zero values

Part of the code was made using help, i.e. I didn't write my own codes, but took them from off sources, so that beginner programmers could see the familiar code.

So the code is shorter by 1 line, it is more convenient and familiar to me, plus beginners will see the additional possibility of the language.

if(new_time != old_time)
    // Update old_time and return true (new bar detected)
    if((old_time = new_time) != NULL)
      return(true);

и

if(new_time != old_time)
    // Update old_time and return true (new bar detected)
      {
       old_time = new_time;
       return(true);
      }
 
Vitaly Muzichenko #:

The check for setting TP and SL orders is implemented incorrectly - in case of failure the position is left at random with zero values

What should be done with this?

My vision is to set TP and SL in any case, if we get an error that the distance is less than the minimum allowable = set it to the minimum allowable.

Now in the current form, the order is not set, and the position remains abandoned at random.

 
Hello, I saw a post that in the MT4 version of the EA the code has been fixed, but in the MT5 version has the code been fixed?