Need help with TD Pivot indicator
  #1 (permalink)  
Old 09-02-2007, 12:00 PM
Freshman
 
Join Date: Jun 2007
Posts: 3
Thanks: 1
Thanked 2 Times in 1 Post
Chris30 is on a distinguished road
Default Need help with TD Pivot indicator

Hi,

I need some help with the TD Pivot indicator.

I want the indicator to show the weekly pivot lines on the daily chart. As you can see on the attached picture, the indicator builds the pivot lines of seven days instead of five days.

What to do to make the indicator build the pivot and show the pivot of five consecutive days instead of seven?

The code is:

Quote:
//+------------------------------------------------------------------+
//| TD Pivot.mq4 |
//+------------------------------------------------------------------+
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 RoyalBlue
#property indicator_color2 OrangeRed

//---- buffers
double high[],
low[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
IndicatorShortName("TD Pivot");
//---- indicators
SetIndexLabel (0,"High");
SetIndexStyle (0,DRAW_LINE);
SetIndexBuffer(0,high);
SetIndexLabel (1,"Low");
SetIndexStyle (1,DRAW_LINE);
SetIndexBuffer(1,low);
//----
return(0);
}

//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
//----
for (int i = Bars-IndicatorCounted(); i >= 0; i--)
{
if(TimeHour(iTime(NULL,0,i)) != 0)
{
high[i] = high[i+1];
low[i] = low[i+1];
continue;
}

int candlesPerWeek = PERIOD_W1/Period(),
week = MathFloor(i/candlesPerWeek)+1;

double H = iHigh(NULL,PERIOD_W1,week),
L = iLow(NULL,PERIOD_W1,week),
O = iOpen(NULL,PERIOD_W1,week),
C = iClose(NULL,PERIOD_W1,week),
X;

if (C < O) X = H + 2*L + C;
else if (C > O) X = 2*H + L + C;
else if (C ==O) X = H + L + 2*C;

high[i] = 0.5*X - L;
low[i] = 0.5*X - H;
}
//----
return(0);
}
//+------------------------------------------------------------------+
Attached Images
File Type: gif td-pivot.gif (11.4 KB, 15 views)
EA Shark +1064% Return
Stock Market Crash? No Problem!
We Are Making Profits As Usual. More Info
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pivot Points Ravique Indicators 11 11-02-2008 02:03 AM
pivot points nobleladdie Indicators 11 02-26-2008 02:42 PM
Free pivot and resistance indicator sneverdies Indicators 3 10-22-2007 05:01 PM
Any help with pivot points???? nobleladdie Forex Beginners 0 08-04-2007 11:26 PM
Need An Pivot Expert Please ahmed System Coding 0 06-05-2007 08:42 PM


All times are GMT. The time now is 11:31 PM.
Powered by vBulletin Version 3.6.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.1.0

Registered members have access to special online forex currency trading tools, software, mt4 expert advisors and indicators. Register now

Main Menu

Economic Forecast