I'm looking to draw lines on a chart that refernce the high and low for the period outside of the london session (8-5 gmt0). So, during the hours, the lines shouldn't change.
I'm including an indicator that I did that will calculate every new candle based on how many candles you want to go back. But I can't seem to figure out how to carry a value over w/out re-calculating.
I'm including an indicator that I did that will calculate every new candle based on how many candles you want to go back. But I can't seem to figure out how to carry a value over w/out re-calculating.
Inserted Code
//+------------------------------------------------------------------+ //| High Low Shift.mq4 | //| Copyright 2013, Nondisclosure007 | //| http://no.link.yet | //+------------------------------------------------------------------+ #property copyright "Copyright 2013, Nondisclosure007" #property link "http://no.link.yet" #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Blue #property indicator_color2 Red extern int intDistance=8; double UpBuffer[], DownBuffer[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,UpBuffer); SetIndexStyle(1,DRAW_LINE); SetIndexBuffer(1,DownBuffer); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int counted_bars=IndicatorCounted(); int limit; if(counted_bars<0) return(-1); if(counted_bars>0) counted_bars--; limit=Bars-counted_bars; for(int shift=0; shift<limit; shift++) { UpBuffer[shift]=High[iHighest(NULL,0,MODE_HIGH,intDistance,shift+1)]; DownBuffer[shift]=Low[iLowest(NULL,0,MODE_LOW,intDistance,shift+1)]; } return(0); } //+------------------------------------------------------------------+