|
|
发表于 2008-9-25 22:41:32
|
显示全部楼层
Entering points when the fractal line is penetrated are marked by blue and red arrows.
The development environment MQL4 will help us to know the fractal ideology better.
Let us define a problem to test fractals:
draw fractals buy/sell;
draw horizontal penetrating levels;
draw fractal lines;
mark the expected entering points with arrows.
Fractals Buy/Sell
This is the most elementary part. We should also consider indicator iFractal available in MQL4 (in Omega, I had to write this indicator myself, and it was rather difficult due to Omega's properties). The examples of how to write this indicator can be found in Code Base.
Horizontal Levels of Penetration
Let us use standard horizontal lines. We will specify the the price of a fractal as a price coordinate, the date of forming the fractal and the current time will be given as time coordinates.
ObjectCreate("SimpleUp"+Up,OBJ_TREND,0,bufUpDate[Up], bufUpPrice[Up],Time[i-1],bufUpPrice[Up]);
ObjectSet("SimpleUp"+Up,OBJPROP_COLOR,Aqua);
ObjectSet("SimpleUp"+Up,OBJPROP_RAY,True);
Fractal Lines
The simplest way seems to be drawing of trend lines through 2 points. We make a ray of the line and wait for penetration. However, indeed, it does not seem to be possible to compare the close price and value of the price on the fractal line since function ObjectGet can return only values of points that have formed the fractal line. So what are we to do?
We should remember analytic geometry. We have 2 points, so we have a straight-line equation. And, since we know the time coordinate, we can easily obtain the price value from the straight-line equation. The canonical straight-line equation looks like this: |
|