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 02-22-2007, 04:38 PM
Member
 
Join Date: Feb 2007
Posts: 30
justize is on a distinguished road
Need help with Momentum

Hello,
i just started coding MQL4, so I have many problems with it
I just want create an indicator which shows/calculate the following:

"1. Graph" = Mom(3) + Mom(5) + Mom(7)
-This should show the speed of change.

In the second window should be shown the following:

"2. Graph" = Mom(Mom(3)) + Mom(Mom(5)) + Mom(Mom(7))
-This should show the acceleration of change.

Later, I need those two calculations for an EA, too. But first I want to get them drawed in an indicator.

Can someone help me?
Here I started to calc the 3-Car-Momentum, but the graph doesn´t work
=========================================
int pos=Bars-counted_bars;
double dMedian ,dMedian1, dResult;
//----main calculation loop
while(pos>=0)
{
dMedian = (High[pos] + Low[pos]) / 2; //medianPrice
dMedian1 = (High[pos+3] + Low[pos+3]) / 2;
dResult = dMedian*100/dMedian1; //Momentum of medianprice
ExtMapBuffer1[pos] = dResult; //fill buffer with results
pos--; //calc next bar
}
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 02-23-2007, 06:08 AM
Member
 
Join Date: Feb 2007
Posts: 30
justize is on a distinguished road
I think the error must be in this line:

dMedian1 = (High[pos+3] + Low[pos+3]) / 2;

When i am writing the following:

ExtMapBuffer1[pos] = dMedian;

On the whole chart/indicator-window the median will be calculatet, so the error must be in on of the following lines....

Doesn´t have anybody a good idea??
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
  #3 (permalink)  
Old 02-23-2007, 07:08 AM
ralph.ronnquist's Avatar
Senior Member
 
Join Date: Oct 2006
Posts: 297
ralph.ronnquist is on a distinguished road
Quote:
Originally Posted by justize
int pos=Bars-counted_bars;
double dMedian ,dMedian1, dResult;
//----main calculation loop
while(pos>=0)
{
dMedian = (High[pos] + Low[pos]) / 2; //medianPrice
dMedian1 = (High[pos+3] + Low[pos+3]) / 2;
dResult = dMedian*100/dMedian1; //Momentum of medianprice
ExtMapBuffer1[pos] = dResult; //fill buffer with results
pos--; //calc next bar
}
In the beginning, you will find two bars for which dMedian1 would be zero, and I suspect MT4 gets quite uppity with division by 0. Thus, make sure that pos < Bars - 2.
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
  #4 (permalink)  
Old 02-23-2007, 10:20 AM
Member
 
Join Date: Feb 2007
Posts: 30
justize is on a distinguished road
Thank you very much, that was it!
I have coded this now:

while(pos>=0)
{
dMedian = (High[pos] + Low[pos]) / 2;
dMedian1 = (High[pos+3] + Low[pos+3]) / 2;
if (dMedian1 == 0) dMedian1 = 1;
dResult = dMedian*100/dMedian1;
ExtMapBuffer1[pos] = dResult;
pos--;
}

Now it seems to work.
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
Momentum indicator droesparky Setup Questions 40 09-08-2009 04:31 AM
Linear Momentum 006 General Discussion 7 10-09-2007 10:31 AM
Momentum price patterns tradewiser Indicators - Metatrader 4 1 09-28-2007 04:13 AM
Momentum hosam Indicators - Metatrader 4 1 02-04-2006 04:27 AM


All times are GMT. The time now is 03:55 AM.



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