Forex



Go Back   Forex Trading > Training > Metatrader > Metatrader 4 mql 4 - Development course > Questions
Forex Forum Register More recent 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 06-20-2007, 10:52 PM
Member
 
Join Date: Aug 2006
Posts: 49
dustovshio is on a distinguished road
ema

How would one modify the tutorial to make an ema with a constant .1 instead of the average between high and low? For some strange reason the ema goes straight down 3-4 bars before the last bar. Any idea why?

Update: Ok I think it's because the if the current bar - last bar returns a negative value the while loop continues to average it it to the ema. So I guess the fix is to simply not calculate the last bar until it closes.

D
Attached Images
File Type: gif usdchf_6.15.07_17.15.gif (15.4 KB, 57 views)
Attached Files
File Type: mq4 ema.mq4 (2.2 KB, 14 views)

Last edited by dustovshio; 06-21-2007 at 02:46 AM.
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 06-28-2007, 09:16 PM
Senior Member
 
Join Date: Feb 2006
Posts: 587
Michel is on a distinguished road
Quote:
Originally Posted by dustovshio View Post
How would one modify the tutorial to make an ema with a constant .1 instead of the average between high and low? For some strange reason the ema goes straight down 3-4 bars before the last bar. Any idea why?

Update: Ok I think it's because the if the current bar - last bar returns a negative value the while loop continues to average it it to the ema. So I guess the fix is to simply not calculate the last bar until it closes.

D
I think that the double ema must be declared outsite of the start() function : when you attach your indic on a chart, it's ok because the previous value of ema is keeped in the loop, but when it's running live, start() is called at each new tick to update only the last bar value, and thus you have to remember the previous value of ema between two start() calls.
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


All times are GMT. The time now is 09:00 AM.



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