Forex



Go Back   Forex Trading > Downloads > Indicators - Metatrader 4
Forex Forum Register More recent Blogs Calendar Advertising Others Help






Register
Welcome to Forex-TSD!, one of the largest Forex forums worldwide, where you will be able to find the most complete and reliable Forex information imaginable.

From the list below, select the forum that you want to visit and register to post, as many times you want. It’s absolutely free. Click here for registering on Forex-TSD.

Exclusive Forum
The Exclusive Forum is the only paid section. Once you subscribe, you will get free access to real cutting-edge Trading Systems (automated and not), Indicators, Signals, Articles, etc., that will help and guide you, in ways that you could only imagine, with your Forex trading.
  • Elite Section
    Get access to private discussions, specialized support, indicators and trading systems reported every week.
  • Advanced Elite Section
    For professional traders, trading system developers and any other member who may need to use and/or convert, the most cutting-edge exclusive indicators and trading systems for MT4 and MT5.
See more

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 08-31-2007, 04:45 PM
Member
 
Join Date: Feb 2007
Posts: 30
Chris29 is on a distinguished road
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?

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, 220 views)
Attached Files
File Type: mq4 TD Pivot.mq4 (1.9 KB, 37 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #2 (permalink)  
Old 09-04-2007, 05:18 PM
Member
 
Join Date: Feb 2007
Posts: 30
Chris29 is on a distinguished road
Noone can help?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Historical Pivot Indicator jerseydevil20 Indicators - Metatrader 4 42 08-11-2009 06:33 PM
Name that Pivot Indicator - Help Please ??? euro_dude Metatrader 4 8 05-31-2009 03:40 PM
Pivot Point Indicator Money Duck Indicators - Metatrader 4 1 12-18-2008 06:05 AM
Pivot indicator which ONLY displays Current DAY's Pivot lines.. Kent Indicators - Metatrader 4 0 07-18-2007 01:03 AM
Help - Pivot Indicator Only HMTRG Indicators - Metatrader 4 4 03-02-2007 04:17 PM


All times are GMT. The time now is 08:34 AM.



Search Engine Friendly URLs by vBSEO 3.2.0 ©2008, Crawlability, Inc.