Coding help please, can anyone make this MT5 indicator based on fractal collect data from other time frame?

To add comments, please log in or register
Tarik Aljanabi
231
Tarik Aljanabi  

Hi all,


I using a very helpful MT5 indicator which I found it free in this website, I use it in my daily trading, but I see it will be great if I can choose which time frame should the indicator collect data from, for example I attach it to daily chart but I want the indicator showing results based on the monthly chart, Can anyone help me please?


Best Regards

William Roeder
19441
William Roeder  
Tarik Aljanabi: Can anyone help me please?
Help you with what? You haven't stated a problem, you stated a want. Show us your attempt (using the CODE button) and state the nature of your problem.
          No free help
          urgent help.

Or pay someone. Top of every page is the link Freelance.

Tarik Aljanabi
231
Tarik Aljanabi  
William Roeder:
Help you with what? You haven't stated a problem, you stated a want. Show us your attempt (using the CODE button) and state the nature of your problem.
          No free help
          urgent help.

Or pay someone. Top of every page is the link Freelance.

Thanks William Roeder,


I thought it's easy for someone here to make this indicator take data from other time frame, for example add an option to the indicator " use time frame H1,4H...etc , this is the help I need.


Best Regards

Brian Rumbles
733
Brian Rumbles  

Try line 64 FRA_Handle=iFractals(NULL,0); The 0 means current time frame. If you push F1 the help menu launches, then type iFractals, by period you can click on Enum_timeframes, find the time frame you want and copy it, then place it where the zero is   


FRA_Handle=iFractals(NULL,PERIOD_MN1)

I have not checked to see if this works or if anything else needs to be changed
Tarik Aljanabi
231
Tarik Aljanabi  
Brian Rumbles:

Try line 64 FRA_Handle=iFractals(NULL,0); The 0 means current time frame. If you push F1 the help menu launches, then type iFractals, by period you can click on Enum_timeframes, find the time frame you want and copy it, then place it where the zero is   


FRA_Handle=iFractals(NULL,PERIOD_MN1)

I have not checked to see if this works or if anything else needs to be changed

Many Thanks,


I did it but the indicator now work only on the MN1 chart and not showing anything on other time frames.


Best Regards

Brian Rumbles
733
Brian Rumbles  

I found these links helpful, I could not get the code to use the other time frame data

For mql4

https://www.mql5.com/en/forum/173574/page348#comment_4542105               Looked at code in remjie's post  r3_mtf_matrv2.mq4 

line 103  ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TimeFrame);


This function not available in mql5

https://www.mql5.com/en/forum/188388



Documentation on MQL5: Timeseries and Indicators Access / CopyRates
Documentation on MQL5: Timeseries and Indicators Access / CopyRates
  • www.mql5.com
Gets history data of MqlRates structure of a specified symbol-period in specified quantity into the rates_array array. The elements ordering of the copied data is from present to the past, i.e., starting position of 0 means the current bar. If you know the amount of data you need to copy, it should better be done to a statically allocated...
Brian Rumbles
733
Brian Rumbles  

So have to somehow use this code for mql5

https://www.mql5.com/en/docs/series/copyrates


void OnStart() 
  { 
//--- 
   MqlRates rates[]; 
   ArraySetAsSeries(rates,true); 
   int copied=CopyRates(Symbol(),0,0,100,rates); 
   if(copied>0) 
     { 
      Print("Bars copied: "+copied); 
      string format="open = %G, high = %G, low = %G, close = %G, volume = %d"; 
      string out; 
      int size=fmin(copied,10); 
      for(int i=0;i<size;i++) 
        { 
         out=i+":"+TimeToString(rates[i].time); 
         out=out+" "+StringFormat(format, 
                                  rates[i].open, 
                                  rates[i].high, 
                                  rates[i].low, 
                                  rates[i].close, 
                                  rates[i].tick_volume); 
         Print(out); 
        } 
     } 
   else Print("Failed to get history data for the symbol ",Symbol()); 
  }



I don't know how to get it to work, need advice from someone more skilled than me

Documentation on MQL5: Timeseries and Indicators Access / CopyRates
Documentation on MQL5: Timeseries and Indicators Access / CopyRates
  • www.mql5.com
Gets history data of MqlRates structure of a specified symbol-period in specified quantity into the rates_array array. The elements ordering of the copied data is from present to the past, i.e., starting position of 0 means the current bar. If you know the amount of data you need to copy, it should better be done to a statically allocated...
To add comments, please log in or register