PDA

View Full Version : Need help adding timeframes



oxmaygelao1950
04-22-2019 00:27, 12:27 AM
Would anybody be prepared to so me the way to modify this code so that I may find a weekly and monthly stretch station?




#property copyright Copyright © Pointzero-trading. Com
#property link http://www.pointzero-trading.com
#property indior_chart_window
#property indior_buffers two
#property indior_color1 MediumSpringGreen
#property indior_color2 MediumSpringGreen
#property indior_width1 two
#property indior_width2 two
#property indior_style1 STYLE_SOLID
#property indior_style2 STYLE_SOLID
//-- External variables
extern int StPeriod = 10;

//-- Buffers
dual FextMapBuffer1[];
dual FextMapBuffer2[];
// ------------------------------------------------------------------
//| Custom indior initialization function |
//|------------------------------------------------------------------|
int init()

SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0, FextMapBuffer1);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1,FextMapBuffer2);
IndiorShortName(Stretch Breakout Channel ( StPeriod ));

return(0);

// ------------------------------------------------------------------
//| Custom indior deinitialization function |
// ------------------------------------------------------------------
int deinit()

return(0);

// ------------------------------------------------------------------
//| Custom indior iteration function |
// ------------------------------------------------------------------
int begin ()

// Start, limit, etc..
Int begin = 0;
int limit;
int counted_bars = IndiorCounted();

// nothing else to do?
If(counted_bars lt; 0)
return(-1);
// do not assess repeated bars
restrict = Bars - 1 - counted_bars;

// Iteration
for(int pos = limit; pos gt;= begin; pos--)

int dshift = iBarShift(Symbol(), PERIOD_D1, Time[pos], false);
double elongate = iCustom(Symbol(), PERIOD_D1, Stretch, StPeriod, 0, dshift 1);
dual OPEN = iOpen(Symbol(), PERIOD_D1, dshift);
FextMapBuffer1[pos] = OPEN elongate;
FextMapBuffer2[pos] = OPEN - elongate;

return(0);