Multi-timeframe indicator

Created at 15 Oct 2013, 11:09
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
FO

fomega

Joined 18.09.2013

Multi-timeframe indicator
15 Oct 2013, 11:09


Hi to everybody,
I want to try a new strategy and I need the Bollinger Band ad RSI multi-timeframe, but I don't know how to code it by myself.
Could someone try to code it or tell me were can learn programing language?
Thanks
 


@fomega
Replies

fomega
15 Oct 2013, 18:03

bollinger mtf code mt4

I've found these metatrader4 code for bollinger band multi-timeframe, I try to convert with 2calgo.com but it doesn't work...
 

//+------------------------------------------------------------------+
//|                                          Bollinger-Bands_MTF.mq4 |
//|        ©2011 Best-metatrader-indicators.com. All rights reserved |
//|                        http://www.best-metatrader-indicators.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2011 Best-metatrader-indicators.com."
#property link      "http://www.best-metatrader-indicators.com"
//----
#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 DodgerBlue
#property indicator_color2 Tomato
#property indicator_color3 Tomato
//---- indicator parameters
extern string TimeFrameNote="TimeFrame =0 - Current Timeframe, =1 - 1MIN, =5 - 5MIN, =5 - 5MIN, =15 - 15MIN, =30 - 30MIN, =60 - 1H, =240 - 4H, =1440 - D1, =10080 - W1, =43200 - MN1";
extern int TimeFrame=0;
extern int    BandsPeriod=20;
extern int    BandsShift=0;
extern double BandsDeviations=2.0;
extern int    BandsAppliedPrice=0;
//---- buffers
double MovingBuffer[];
double UpperBuffer[];
double LowerBuffer[];
string Copyright="\xA9 WWW.BEST-METATRADER-INDICATORS.COM";  
string MPrefix="FI";
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,MovingBuffer);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,UpperBuffer);
   SetIndexStyle(2,DRAW_LINE);
   SetIndexBuffer(2,LowerBuffer);
//----
   SetIndexDrawBegin(0,BandsPeriod+BandsShift);
   SetIndexDrawBegin(1,BandsPeriod+BandsShift);
   SetIndexDrawBegin(2,BandsPeriod+BandsShift);
//---- name for DataWindow and indicator subwindow label   
   switch(TimeFrame)
     {
      case 1 : string TimeFrameStr="TF: M1"; break;
      case 5 : TimeFrameStr="TF: M5"; break;
      case 15 : TimeFrameStr="TF: M15"; break;
      case 30 : TimeFrameStr="TF: M30"; break;
      case 60 : TimeFrameStr="TF: H1"; break;
      case 240 : TimeFrameStr="TF: H4"; break;
      case 1440 : TimeFrameStr="TF: D1"; break;
      case 10080 : TimeFrameStr="TF: W1"; break;
      case 43200 : TimeFrameStr="TF: MN1"; break;
      default : TimeFrameStr="Current Timeframe";
     }
   IndicatorShortName("Bollinger Bands MTF (Period: "+BandsPeriod+", "+TimeFrameStr+")");
   DL("001", Copyright, 5, 20,Gold,"Arial",10,0);
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   ClearObjects();
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   datetime TimeArray[];
   int    i,limit,y=0,counted_bars=IndicatorCounted();

   ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TimeFrame);
   limit=Bars-counted_bars;
   for(i=0,y=0;i<limit;i++)
     {
      if (Time[i]<TimeArray[y]) y++;
//----
      MovingBuffer[i]=iBands(NULL,TimeFrame,BandsPeriod,BandsDeviations,BandsShift,BandsAppliedPrice,MODE_MAIN,y);
      UpperBuffer[i]=iBands(NULL,TimeFrame,BandsPeriod,BandsDeviations,BandsShift,BandsAppliedPrice,MODE_UPPER,y);
      LowerBuffer[i]=iBands(NULL,TimeFrame,BandsPeriod,BandsDeviations,BandsShift,BandsAppliedPrice,MODE_LOWER,y);
     }
   //----
   return(0);
  }
//+------------------------------------------------------------------+
//| DL function                                                      |
//+------------------------------------------------------------------+
 void DL(string label, string text, int x, int y, color clr, string FontName = "Arial",int FontSize = 12, int typeCorner = 1)
 
{
   string labelIndicator = MPrefix + label;   
   if (ObjectFind(labelIndicator) == -1)
   {
      ObjectCreate(labelIndicator, OBJ_LABEL, 0, 0, 0);
  }
   
   ObjectSet(labelIndicator, OBJPROP_CORNER, typeCorner);
   ObjectSet(labelIndicator, OBJPROP_XDISTANCE, x);
   ObjectSet(labelIndicator, OBJPROP_YDISTANCE, y);
   ObjectSetText(labelIndicator, text, FontSize, FontName, clr);
 
}  

//+------------------------------------------------------------------+
//| ClearObjects function                                            |
//+------------------------------------------------------------------+
void ClearObjects()
{
  for(int i=0;i<ObjectsTotal();i++)
  if(StringFind(ObjectName(i),MPrefix)==0) { ObjectDelete(ObjectName(i)); i--; }
}
//+------------------------------------------------------------------+

 


@fomega

fomega
15 Oct 2013, 18:04

RSI mtf

and these code mt4 is for RSI multi-timeframe:
 

//+------------------------------------------------------------------+
//|                                                      RSI_MTF.mq4 |
//|        ©2011 Best-metatrader-indicators.com. All rights reserved |
//|                        http://www.best-metatrader-indicators.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2011 Best-metatrader-indicators.com."
#property link      "http://www.best-metatrader-indicators.com"
//----
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 DodgerBlue
#property indicator_level1 30
#property indicator_level2 70
#property indicator_minimum 0
#property indicator_maximum 100
//----
extern string TimeFrameNote="TimeFrame =0 - Current Timeframe, =1 - 1MIN, =5 - 5MIN, =15 - 15MIN, =30 - 30MIN, =60 - 1H, =240 - 4H, =1440 - D1, =10080 - W1, =43200 - MN1";
extern int TimeFrame=0;
extern int RSIperiod=14;
extern int applied_price=0;
//----
double ExtMapBuffer1[];
string Copyright="\xA9 WWW.BEST-METATRADER-INDICATORS.COM";  
string MPrefix="FI";
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicator line
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexStyle(0,DRAW_LINE);
//---- name for DataWindow and indicator subwindow label   
   switch(TimeFrame)
     {
      case 1 : string TimeFrameStr="Period_M1"; break;
      case 5 : TimeFrameStr="Period_M5"; break;
      case 15 : TimeFrameStr="Period_M15"; break;
      case 30 : TimeFrameStr="Period_M30"; break;
      case 60 : TimeFrameStr="Period_H1"; break;
      case 240 : TimeFrameStr="Period_H4"; break;
      case 1440 : TimeFrameStr="Period_D1"; break;
      case 10080 : TimeFrameStr="Period_W1"; break;
      case 43200 : TimeFrameStr="Period_MN1"; break;
      default : TimeFrameStr="Current Timeframe";
     }
   IndicatorShortName("MTF_RSI("+RSIperiod+") ("+TimeFrameStr+")");
   DL("001", Copyright, 5, 20,Gold,"Arial",10,0);
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   ClearObjects();
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   datetime TimeArray[];
   int    i,limit,y=0,counted_bars=IndicatorCounted();
   // Plot defined time frame on to current time frame
   ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TimeFrame);
   limit=Bars-counted_bars;
   for(i=0,y=0;i<limit;i++)
     {
      if (Time[i]<TimeArray[y]) y++;
//----
      ExtMapBuffer1[i]=iRSI(NULL,TimeFrame,RSIperiod,applied_price,y);
     }
   //----
   return(0);
  }
//+------------------------------------------------------------------+
//| DL function                                                      |
//+------------------------------------------------------------------+
 void DL(string label, string text, int x, int y, color clr, string FontName = "Arial",int FontSize = 12, int typeCorner = 1)
 
{
   string labelIndicator = MPrefix + label;   
   if (ObjectFind(labelIndicator) == -1)
   {
      ObjectCreate(labelIndicator, OBJ_LABEL, 0, 0, 0);
  }
   
   ObjectSet(labelIndicator, OBJPROP_CORNER, typeCorner);
   ObjectSet(labelIndicator, OBJPROP_XDISTANCE, x);
   ObjectSet(labelIndicator, OBJPROP_YDISTANCE, y);
   ObjectSetText(labelIndicator, text, FontSize, FontName, clr);
 
}  

//+------------------------------------------------------------------+
//| ClearObjects function                                            |
//+------------------------------------------------------------------+
void ClearObjects()
{
  for(int i=0;i<ObjectsTotal();i++)
  if(StringFind(ObjectName(i),MPrefix)==0) { ObjectDelete(ObjectName(i)); i--; }
}
//+------------------------------------------------------------------+


@fomega

algotrader
15 Oct 2013, 18:34

New version of converter has been released. Both of your indicators are supported. You can convert it right now with 2calgo.com


@algotrader

fomega
15 Oct 2013, 19:21

error 404

Sorry mate, i try but the result is Error 404 :(


@fomega

algotrader
15 Oct 2013, 20:02

RE: error 404

fomega said:

Sorry mate, i try but the result is Error 404 :(

Please try one more time. There was a problem with compatibillity with firefox and IE browsers.


@algotrader

fomega
15 Oct 2013, 20:23

RE: RE: error 404

algotrader said:

fomega said:

Sorry mate, i try but the result is Error 404 :(

Please try one more time. There was a problem with compatibillity with firefox and IE browsers.

now it work!! thanks algotrader


@fomega