Re: Fractals Geometry v1.4 (MTF) Fixed Final

812
dmnik wrote: Tue Oct 03, 2023 8:17 am Can you explain the new functionality?
Hi dmnik,

I just had a quick look at the code and all I can say is that I just fixed it to show all the dots and fractal lines in the right place in both current and multi timeframe modes. However, to tell you the truth, this indicator proved to be useless to me since it didn't give me an edge in my trading analysis, so I stopped testing it. It does what it does so others may still find it useful. It boils down to what works best for you.
These users thanked the author global for the post (total 2):
Darkdoji, dmnik

Re: Fractals Geometry fix Orbit Tool Inspiration

814
global wrote: Wed Oct 04, 2023 6:30 am Hi dmnik,

I just had a quick look at the code and all I can say is that I just fixed it to show all the dots and fractal lines in the right place in both current and multi timeframe modes. However, to tell you the truth, this indicator proved to be useless to me since it didn't give me an edge in my trading analysis, so I stopped testing it. It does what it does so others may still find it useful. It boils down to what works best for you.
I just saw that Darkdoji thanked me for that post. Actually, my testing of the Fractals Geometry indicator was inspired by Darkdoji's explanations about the financial markets being based on fractals. He said, "The market is not random and therefore not explained by any other alternative view, the market is a chaotic system underpinned by a fractal structure.... a chaotist is a person who applies the precepts of chaos theory and fractal geometry to financial markets".

So with the MTF Fractals Geometry indicator I looked for confluence of the direction and strength of the fractals on multiple timeframes, on the M5, M15, M30, H1 and H4 timeframes. I assigned a value of 1 or -1 to the direction of the current leg of the fractals on each timeframe, then found the average. That average told me how strong the directional bias was and I used that as an additional trade entry confirmation along with whatever other indicators I was using.

Below are a few lines of code that shows how I evaluated the average fractal directional bias values. Those values were shown as different colors of a histogram so I could see what they were currently, and historically to see how well it worked in the past to predict good trades.

Code: Select all

                  if(value>1) { theColor = StrongUp; eToolTip="StrongUp"; }
                  else if(value>0.5) { theColor = MidUp; eToolTip="MidUp"; }
                  else if(value>0) { theColor = WeakUp; eToolTip="WeakUp"; }
                  else if(value<-1) { theColor = StrongDown; eToolTip="StrongDown"; }
                  else if(value<-0.5) { theColor = MidDown; eToolTip="MidDown"; }
                  else if(value<0) { theColor = WeakDown; eToolTip="WeakDown"; }
In conclusion, although the results were ok, it wasn't the holy grail and I felt that it didn't give me the extra edge I was looking for. Maybe, the Orbit Tools can give that edge based on Fractal Geometry but I was unable to wrap my head around it, plus I was looking for things I could code into trading expert advisors but I was unable to translate the Orbit Tool into code I could work with.
These users thanked the author global for the post (total 2):
Darkdoji, dmnik

Re: Fractals Geometry fix Orbit Tool Inspiration

815
global wrote: Wed Oct 04, 2023 9:25 am Below are a few lines of code that shows how I evaluated the average fractal directional bias values. Those values were shown as different colors of a histogram so I could see what they were currently, and historically to see how well it worked in the past to predict good trades.
Here are more lines of code that show how I evaluated the average fractal directional bias values. Those values were shown as different colors of a histogram so I could see what they were currently, and historically to see how well it worked in the past to predict good trades. Just compile the code below and it should work. Please let me know if you get any errors.

Code: Select all

#property indicator_separate_window
#property indicator_buffers 7
#property indicator_minimum 0
#property indicator_maximum 1
#property strict

extern string TimeFrames        = "M5;M15;M30;H1;H4";              // Time frames to use (separated by ";" in the list)
extern int    MaxBars           = 500;   // Maximum Bars
extern bool   UseOrigFormula    = false; // Use Original Formula
extern bool   UseDpsAvg         = true;                            // Use FG Average
extern color  StrongUp          = clrAqua;                         // Color for strong up
extern color  MidUp             = clrDodgerBlue;                   // Color for mid up
extern color  WeakUp            = clrDarkSlateBlue;                // Color for weak up
extern color  NoMove            = clrSilver;                       // Color for no trend
extern color  WeakDown          = clrMaroon;                       // Color for weak down
extern color  MidDown           = clrFireBrick;                    // Color for mid down
extern color  StrongDown        = clrRed;                          // Color for strong down
extern int    HistogramWidth     = 3;          // Histogram width

double buffer1[], buffer2[], buffer3[], buffer4[], buffer5[], buffer6[], Bias[];
int ctimesLen, aTimes[];

bool returnBars;
string indyFractalGeo="Fractals  Geometry v1.4_mt_fix3";
double value;

int OnInit()
{
   IndicatorBuffers(7);

   SetIndexBuffer(0,buffer1); SetIndexLabel(0,"StrongUp");
   SetIndexBuffer(1,buffer2); SetIndexLabel(1,"MidUp");
   SetIndexBuffer(2,buffer3); SetIndexLabel(2,"WeakUp");
   SetIndexBuffer(3,buffer4); SetIndexLabel(3,"StrongDown");
   SetIndexBuffer(4,buffer5); SetIndexLabel(4,"MidDown");
   SetIndexBuffer(5,buffer6); SetIndexLabel(5,"WeakDown");
   SetIndexBuffer(6,Bias); SetIndexStyle(6,DRAW_NONE); SetIndexLabel(6,"Bias");
   
   SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,HistogramWidth,StrongUp);
   SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID,HistogramWidth,MidUp);
   SetIndexStyle(2,DRAW_HISTOGRAM,STYLE_SOLID,HistogramWidth,WeakUp);
   SetIndexStyle(3,DRAW_HISTOGRAM,STYLE_SOLID,HistogramWidth,StrongDown);
   SetIndexStyle(4,DRAW_HISTOGRAM,STYLE_SOLID,HistogramWidth,MidDown);
   SetIndexStyle(5,DRAW_HISTOGRAM,STYLE_SOLID,HistogramWidth,WeakDown);
    
   ctimesLen = ArraySize(aTimes);
   int s = 0, i = StringFind(TimeFrames,";",s);
   while(i > 0)
   {
      string current = StringSubstr(TimeFrames,s,i-s);
      int time = stringToTimeFrame(current);
      if(time > 0)
      {
         ArrayResize(aTimes,ArraySize(aTimes)+1);
         aTimes[ArraySize(aTimes)-1] = time;
      }
      s = i + 1;
      i = StringFind(TimeFrames,";",s);
   }
   
   IndicatorDigits(Digits);
     
   return(INIT_SUCCEEDED);
}

int start()
{
   int counted_bars=IndicatorCounted();
   int pos,limit;

   if(counted_bars<0) return(-1);
   if(counted_bars>0) counted_bars--;
   limit=MathMin(Bars-counted_bars,Bars-1);
   if(MaxBars>0 && limit>MaxBars) limit=MaxBars;
   if(returnBars) { buffer1[0] = MathMin(limit+1,Bars-1); return(0); }
   
   double sumvalue=0;
   double DpsAvg=0;
   int    ReduceDiv=0;
   color  theColor = NoMove;
   string eToolTip = "NoMove";
   
      for(pos=limit; pos>=0 && !_StopFlag; pos--)
      {
           for(int t = 0; t < ctimesLen; t++)
            {
               //+-----------------------------------------------------------------------------------------------------------+
               // indyFractalGeo="Fractals  Geometry v1.4_mtf_fix3";
               // extern ENUM_TIMEFRAMES TimeFrame = PERIOD_CURRENT; // Time frame

               // For non-MTF version of Fractals  Geometry v1.4
               // double value=iCustom(NULL,aTimes[t],indyFractalGeo,5,pos);
               
               // For MTF version of Fractals  Geometry v1.4_mtf_fix3              
               // double value=iCustom(NULL,0,indyFractalGeo,aTimes[t],5,pos);

               value=iCustom(NULL,0,indyFractalGeo,aTimes[t],5,pos);
               // if(pos==0 && aTimes[t]==240) Comment(value);

               if(t==0) { sumvalue=0; DpsAvg=0; ReduceDiv=0; }

               if(UseOrigFormula)
               {
                  if(value==1 || value==-1) value=0;
                  else if(value==2) value=1;
                  else if(value==-2) value=-1;
               }
               sumvalue+=value;
               if(value==0) ReduceDiv++;

               if(t==ArraySize(aTimes)-1)
               {
                  DpsAvg=DivZero(sumvalue,ArraySize(aTimes)-ReduceDiv);
                     
                // Display as a colored histogram in the subwindow.
                     Bias[pos]=DpsAvg;

                     buffer1[pos] = EMPTY_VALUE; //StrongUp
                     buffer2[pos] = EMPTY_VALUE; //MidUp
                     buffer3[pos] = EMPTY_VALUE; //WeakUp
                     buffer4[pos] = EMPTY_VALUE; //StrongDown
                     buffer5[pos] = EMPTY_VALUE; //MidDown
                     buffer6[pos] = EMPTY_VALUE; //WeakDown

                     if(UseDpsAvg)
                     {
                        theColor = NoMove;
                        eToolTip="NoMove";

                        if(DpsAvg>1) { buffer1[pos] = 1; theColor = StrongUp; eToolTip="StrongUp"; } // StrongUp;
                        // else if(DpsAvg==1) { buffer2[pos] = 1; theColor = MidUp; eToolTip="MidUp"; } // MidUp;
                        else if(DpsAvg>0.5) { buffer2[pos] = 1; theColor = MidUp; eToolTip="MidUp"; } // MidUp;
                        else if(DpsAvg>0) { buffer3[pos] = 1; theColor = WeakUp; eToolTip="WeakUp"; } // WeakUp;

                        else if(DpsAvg<-1) { buffer4[pos] = 1; theColor = StrongDown; eToolTip="StrongDown"; } // StrongDown;
                        // else if(DpsAvg==-1) { buffer5[pos] = 1; theColor = MidDown; eToolTip="MidDown"; } // MidDown;
                        else if(DpsAvg<-0.5) { buffer5[pos] = 1; theColor = MidDown; eToolTip="MidDown"; } // MidDown;
                        else if(DpsAvg<0) { buffer6[pos] = 1; theColor = WeakDown; eToolTip="WeakDown"; } // WeakDown;
                    }
                     else
                     {
                        theColor = NoMove;
                        eToolTip="NoMove";

                        if((int)DpsAvg>1) { buffer1[pos] = 1; theColor = StrongUp; eToolTip="StrongUp"; } // StrongUp;
                        else if((int)DpsAvg==1) { buffer2[pos] = 1; theColor = MidUp; eToolTip="MidUp"; } // MidUp;
                        else if((int)DpsAvg>0) { buffer3[pos] = 1; theColor = WeakUp; eToolTip="WeakUp"; } // WeakUp;

                        else if((int)DpsAvg<-1) { buffer4[pos] = 1; theColor = StrongDown; eToolTip="StrongDown"; } // StrongDown;
                        else if((int)DpsAvg==-1) { buffer5[pos] = 1; theColor = MidDown; eToolTip="MidDown"; } // MidDown;
                        else if((int)DpsAvg<0) { buffer6[pos] = 1; theColor = WeakDown; eToolTip="WeakDown"; } // WeakDown;             
                     }
               } //  if(t==ArraySize(aTimes)-1)
               
            }  // for(int t = 0; t < ctimesLen; t++)
          } //for(pos=limit; pos>=0 && !_StopFlag; pos--)

   return(0);
}

//+------------------------------------------------------------------+
//| TimeFrame Functions                                                    |
//+------------------------------------------------------------------+
string sTfTable[] = {"M1","M5","M15","M30","H1","H4","D1","W1","MN"};
int    iTfTable[] = {1,5,15,30,60,240,1440,10080,43200};

int stringToTimeFrame(string tfs)
{
   StringToUpper(tfs);
   for(int i=ArraySize(iTfTable)-1; i>=0; i--)
      if(tfs==sTfTable[i] || tfs==""+(string)iTfTable[i]) return(iTfTable[i]);
   return(_Period);
}
string timeFrameToString(int tf)
{
   for(int i=ArraySize(iTfTable)-1; i>=0; i--)
      if(tf==iTfTable[i]) return(sTfTable[i]);
   return("");
}
//+------------------------------------------------------------------+
//| DivZero: Divides N by D, and returns 0 if the denominator (D) = 0|                                                          |
//+------------------------------------------------------------------+
double DivZero(double n,double d)
{
// Usage:   double x = DivZero(y,z)  sets x = y/z
// Use DivZero(y,z) instead of y/z to eliminate division by zero errors
   if(d == 0) return(0);  else return(1.0*n/d);
}


Re: Fractals Geometry fix Orbit Tool Inspiration

816
global wrote: Wed Oct 04, 2023 11:42 am Here are more lines of code that show how I evaluated the average fractal directional bias values. Those values were shown as different colors of a histogram so I could see what they were currently, and historically to see how well it worked in the past to predict good trades. Just compile the code below and it should work. Please let me know if you get any errors.
I had some free time so I compiled it myself and found two errors. I missed out the f from mtf, in the name of the indicator called by iCustom, plus I put the line

Code: Select all

 ctimesLen = ArraySize(aTimes);
in the wrong place.

Anyway, I fixed those errors and added Auto Histogram Width. Here is the fully working indicator. You must have the Fractals Geometry v1.4_mtf_fix3.mq4 indicator in your Indicators directory since that is called by this indicator. Note, there are two spaces between the words, Fractals Geometry in the name of the Fractals Geometry v1.4_mtf_fix3.mq4 indicator, so just leave it that way since that same name with the spaces is used in this Fractals Geometry v1.4_mtf_fix3_histo.mq4 indicator in the iCustom call. Of course, when you add the indicators to your Indicators folder, make sure that you compile them. To easily do that, just go to your MT4 menu, click View->Navigator, then right-click on any indicator within your Indicators folder and click Refresh twice. When you click Refresh, wait awhile for the refresh to complete before clicking it again.

So this indicator will show you the multi timeframe average values for each bar on the current timeframe, of the fractal directional bias of ALL the timeframes you enter in the TimeFrames input option. The default timeframes are: M5;M15;M30;H1;H4

Re: MT4 Multi Time Frame (MTF) Indicators

819
Jimmy wrote: Wed Oct 09, 2019 5:05 pm Good question Preethi. Multi Time Frame indicators are beneficial because:

  • They allow you to display the higher timeframe's indicator information in lower timeframes (of course).
  • Using an MTF indicator on a lower timeframe allows you to pin-point your entries to trade into the "bigger" trend, on the lower timeframe.
  • They help traders see higher timeframe information at a glance.
  • Multi time frame indicators allow smaller timeframe traders a look at the overall market sentiment, instead of being "locked" into the view of the lower timeframe.

Example:

One of my favorite ways to use MTF analysis is with the TDI Indicator and the Floating Indicator's MTF function.

In the chart below, you would take the 5 Minute chart's TDI trades into the 4 hour TDI's signal by using the Floating Indicator and MTF.


Image



In the floating indicator's settings, I've set the MTF to the 4 hour timeframe.
When the Floating Indicator's 4 hour TDI crosses on a "strong angle", I won't enter immediately. I'll now watch this 5 minute chart's TDI (in my subwindow) and wait until the 5 minute chart's TDI crosses into the same direction of the Floating Indicator's 4 hour TDI's cross, then I will take the trade into the 4 hour TDI's signal.

By doing this, you will reduce drawdown and you'll be able to enter trades with precision and without switching charts too often.

This same technique applies to all MTF indicators and is also a technique that XARD teaches for using his Simple Trend Following System :)

To sum it all up, a Multi Time Frame indicator's purpose is to allow a smaller timeframe trader to see what the larger timeframe's indicators are doing. And this reduces the need for switching charts and can be beneficial for beginners as nearly all the information needed can be shown on one screen :thumbup:
Hello Jimmy,

I looking for an indicator that can give a signal when all the other indicators on a chart are giving a signal simultaniously or all at the same time.

What about an indicator that looks at when a signal is being given in each timeframe, and alerts when 2 or more timeframes give signals at the same time??

Any suggestions??


Who is online

Users browsing this forum: Bing [Bot], Grapeshot [Bot], kvak, LevFJX, msbh, Proximic [Bot], Ruby [Bot], Tbot [Bot], TEAMTRADER, Yandex [Bot] and 88 guests