Download MetaTrader 5

Plus 2 indicators with differents Time Frames

To add comments, please log in or register
We have launched Spanish and Portuguese versions of the website. Try them!
Daniel Osuna de la Rosa
516
Daniel Osuna de la Rosa 2016.02.21 14:22 

So I want to plus the same indicator of 2 differents time frames and build new one.

I would apreciate any example or any help. There are too much information and is difficult to find that I want, but I'm sure I'm not the first who want to do something like this.

Thanks in advance. 

Damian Mateusz Dziadosz
5778
Damian Mateusz Dziadosz 2016.03.05 21:02  
Do you mean in one timeframe showing 2 timeframes the same indicator?
Daniel Osuna de la Rosa
516
Daniel Osuna de la Rosa 2016.03.21 11:31  
Similar but no I plus the buffer of one timeframe to the other, I made it doing something similar that you say, first I made this indicator in different time frame and later calling this indicator into the otherone with iCustom.
Cheer for your answer but It's fixed. I know it's rare but the buffer represents the probability and works better calculating in more than one time frame and adding others.
Daniel Osuna de la Rosa
516
Daniel Osuna de la Rosa 2016.03.21 11:36  
Thanks for your interest if some day you need help write me by private message I will try to help you quickly.
Jose Ignacio Martin Somokurzio
44
Jose Ignacio Martin Somokurzio 2016.03.21 19:42  

Do not know if this can serve you ...

 

 //+-----------------------------------------------------------------+

// | SARDOS.mq4 |

//+------------------------------------------------------------------+

#property indicator_chart_window

#property show_inputs

#property indicator_color1 Aqua

#property indicator_color2 Red

#include <stdlib.mqh>

#poperty indicator_buffers 2                                        ;

double ExtMapBuffer1[255]                                            ;

double ExtMapBuffer2[255]                                            ;

double ExtParam1 = 100                                               ;


extern int Frame1, Frame2, Ratio                                     ;

//+------------------------------------------------------------------+

//| Custom indicator initialization function                         |

//+------------------------------------------------------------------+

int OnInit()

// --- Indicator 0

   SetIndexStyle(0,DRAW_ARROW)                                       ;

   setındexbuff (0, extmapbuffer1);   

   setındexarrow (0.159); 

   setındexemptyvalu A (0,0.0);

   setındexdrawbeg the (0, extparam1);

// --- Indicator 1

   SetIndexStyle(1,DRAW_ARROW)                                       ;   

   setındexbuff (1, extmapbuffer2);   

   setındexarrow (1.108);        

   setındexemptyvalu A (1,0.0);

   setındexdrawbeg (1, extparam1);

 

   ArrayResize(ExtMapBuffer1, Bars )                                 ;

   ArrayResize(ExtMapBuffer2, Bars )                                 ;

//---

   return(INIT_SUCCEEDED)                                            ;

}

//+------------------------------------------------------------------+

// | Custom indicator deinitialization function |

//+------------------------------------------------------------------+

void OnDeinit(const int reason)

{  

//---- 


//----

}   

//+------------------------------------------------------------------+

//|                Script program start function                     |

//+------------------------------------------------------------------+

int OnCalculate(const int rates_total,

                const int prev_calculated,

                const datetime &time[],

                const double &open[],

                const double &high[],

                const double &low[],

                const double &close[],

                const long &tick_volume[],

                const long &volume[],

                const int &spread[])

{

int nCont = Ratio, m = 0                                             ;

//-------------------------------------------------------------------+

Properties // lines |

//-------------------------------------------------------------------+

   for(int n=0;n< Bars;n++)

       {

        ExtMapBuffer1[n] =  iSAR(NULL,Frame1,0.02,0.2,n )            ;        

        if( n != nCont )

           {

            ExtMapBuffer2[n] = iSAR(NULL,Frame2,0.02,0.2,m )         ;

           }

        else

           {

            ExtMapBuffer2[n] =  iSAR(NULL,Frame2 ,0.02,0.2,m + 1 )   ; 

            nCont =    nCont + Ratio                                 ;

            m = m + 1;

           }

       }

//+-----

   return(rates_total);

}

To add comments, please log in or register