Examples: Drawing Horizontal Break-Through Levels Using Fractals

MetaQuotes
Moderator
226670
MetaQuotes  

New article Drawing Horizontal Break-Through Levels Using Fractals has been published:

The article describes creation of an indicator that would display the support/resistance levels using up/down fractals.

In the first instance, the fractal levels can be useful while moving the StopLoss level under the red line at a rising market. You should keep the StopLoss above the blue line at a receding market. In such a manner the safe intelligent distance between the StopLoss and the market will be ensured.

For example, we entered the market (see the chart, mark 1) with the stop above the blue line (mark 2), if the red line is broken through (mark 3) we move the StopLoss (mark 4), if a new breakthrough occurred (mark 5), we move the StopLoss analogously (mark 6). If the blue line is broken through (mark 7), we liquidate the position.

Author: Victor Chebotariov

[Deleted]  
Is that same with Bollinger Band? Thank You.
[Deleted]  

Handy article and nice coding.


Thanks,

Javier.

[Deleted]  

Hi

I like this a lot but can someone please tell me how to attach it to chart. I have tried the usual but I cannot get the lines drawn on a chart.

Thanks

Ross

Andrea Bronzini
116
Andrea Bronzini  
cornie84:
Is that same with Bollinger Band? Thank You.

No, it seems much better than BB.

This one gives you a much sharper information and narrow range.


I think a piece of code is missing anyway... I couldnt visualize the bars then I noticed that you dont define the ...

I added this 2 lines:


IndicatorBuffers(2);
IndicatorDigits(Digits);


just before SetIndexStyle lines... now it works perfectly.


Thanx for sharing!



Zyp

[Deleted]  

To be expected to do?

I have put in several of my graphics and so far nothing has happened.


Explain please.

[Deleted]  

The variable used for short-position stoploss appears to be incorrectly specified as FLL:

original code

if(Close[0]<FLL) //Trailing-stop for the short positions
  {
   if(OrderStopLoss()>FLL+(Ask-Bid+3)*Point || OrderStopLoss()==0)
     {
      OrderModify(OrderTicket(),OrderOpenPrice(),FLL+(Ask-Bid+3)*Point,OrderTakeProfit(),0,Red);
      return(0);
     }
  }

Correct code(?) using FLU as the price level to base the new short-position's stoploss:

edit: also the use of (Ask-Bid+3)*Point is incorrect...should be simply Ask-Bid+3*Point without the parentheses.

if(Close[0]<FLL) //Trailing-stop for the short positions
  {
   if(OrderStopLoss()>FLU+Ask-Bid+3*Point || OrderStopLoss()==0)
     {
      OrderModify(OrderTicket(),OrderOpenPrice(),FLU+Ask-Bid+3*Point,OrderTakeProfit(),0,Red);
      return(0);
     }
  }
koko
9
koko  

The code is wrong. So should be the test results. Fractals form after the close of at least 2 bars after high/low. This indicator plots lines right after the fractal bar which will not exist in real time -so, it does not work correctly real time.

This shall fix how it gets the values of the upper and lower fractals:

double upfrac_val = iFractals(NULL, 0, MODE_UPPER, i + 3);
double lofrac_val = iFractals(NULL, 0, MODE_LOWER, i + 3);