Forex
Google
New signals service!

Go Back   Forex Trading > Discussion Areas > General Discussion


Register in Forex TSD!
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time).
Click here to register and get more information

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-09-2006, 09:36 AM
Senior Member
 
Join Date: Jan 2006
Posts: 1,119
omelette is on a distinguished road
Programming Question...

Hi. Could anyone tell me if it's possible to have Histograms oscillating about a value other than zero or is this another MT4 limitation. The 'SetLevelValue' command only seems to effect where the center line is drawn which is not the same thing...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 12-09-2006, 12:57 PM
Kalenzo's Avatar
Senior Member
 
Join Date: Dec 2005
Location: Bydgoszcz - Poland
Posts: 696
Kalenzo is on a distinguished road
Quote:
Originally Posted by omelette
Hi. Could anyone tell me if it's possible to have Histograms oscillating about a value other than zero or is this another MT4 limitation. The 'SetLevelValue' command only seems to effect where the center line is drawn which is not the same thing...
It is possible, but dificut too. You need to cover one histogram by another one which. Eg if you wish to have values + 10 and -10 from the 50 line, then you need to fill one histogram with value 60, second (that will cover first one) with value 40 and thirt (that will cover the 2nd histogram from 0 to 40) with background color. Dificult and compilcated, but not impossible !
__________________
You need proffesional mql coder? Contact me! I will help you!
........................................
http://www.fxservice.eu/
........................................
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 12-09-2006, 07:39 PM
Senior Member
 
Join Date: Jan 2006
Posts: 1,119
omelette is on a distinguished road
Quote:
Originally Posted by Kalenzo
It is possible, but dificut too. You need to cover one histogram by another one which. Eg if you wish to have values + 10 and -10 from the 50 line, then you need to fill one histogram with value 60, second (that will cover first one) with value 40 and thirt (that will cover the 2nd histogram from 0 to 40) with background color. Dificult and compilcated, but not impossible !
Kalenzo, thanks, I appreciate your insight. Your right, it is complicated. I was trying to put 2 histos in the same window, each of which uses 3 display buffers so your explanation rules that out! It's a shame there isn't a simple command like 'SetLevelValue' and it seems it should be very easy for the Metatrader programmers to include. Guess they're too busy fixing other bugs
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 12-10-2006, 09:10 AM
Member
 
Join Date: Nov 2006
Posts: 46
SteveBrown is on a distinguished road
A workaround would be to subtract your offset from the computed value before displaying the histogram. Say you want values above 60 to display positive, and values below 60 to display negative. Just subtract 60 from each of the values loaded into the display buffer, and they will display as you want, but you will mentally have to add 60 to each of the values when looking at the histogram.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 12-10-2006, 09:38 PM
Senior Member
 
Join Date: Jan 2006
Posts: 1,119
omelette is on a distinguished road
Quote:
Originally Posted by SteveBrown
A workaround would be to subtract your offset from the computed value before displaying the histogram. Say you want values above 60 to display positive, and values below 60 to display negative. Just subtract 60 from each of the values loaded into the display buffer, and they will display as you want, but you will mentally have to add 60 to each of the values when looking at the histogram.
I'm afraid that doesn't work, which is what prompted me to post the question - the histo will 'run' to the zero line irrespective of the offset. I'm pretty sure the only way to do it is as Kalenzo suggested, which is not practical in practice as the display buffer limitation will prevent you doing anything useful...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 12-12-2006, 01:20 AM
Member
 
Join Date: Nov 2006
Posts: 46
SteveBrown is on a distinguished road
Omlette, perhaps I misunderstand the question? A histogram normally displays positive values above the zero line and negative values below the zero line. So you can force positive values below any arbitrary threshold to be negative. For example, if you want values below 60 to be displayed below the zero line, you can change the following line of code

MacdBuffer[i]=iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i)-iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i);

to this:

MacdBuffer[i]=iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i)-iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i) -60;

It's a workaround, because when you look at the histogram, you mentally have to add 60 to the values displayed. For example, a value displayed as -20 is really +40, but you wanted it displayed below the zero line.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 12-12-2006, 02:29 AM
Senior Member
 
Join Date: Jan 2006
Posts: 1,119
omelette is on a distinguished road
Hi. I know what you are saying but that is not was I was referring to. What I was trying to do was place two Histos in the same separate window, each occupying half that window. What I quickly found was that MT4 forces all histos to the infernal zero line irrespective of what offsets you use - you can offset above or below the zero but the colours will still 'run' to the zero line. For a sec. I thought the solution would be provided by the 'SetLevelValue' but this just sets where the line graphic is displayed. All this would be much easier to explain graphically, unfortunately that code formed the basis of a single histo indicator. You might consider try coding one yourself so you can see this limitation first-hand. It's a pity really 'cos you would think it would be relatively easy to add this feature.

Quote:
Originally Posted by SteveBrown
Omlette, perhaps I misunderstand the question? A histogram normally displays positive values above the zero line and negative values below the zero line. So you can force positive values below any arbitrary threshold to be negative. For example, if you want values below 60 to be displayed below the zero line, you can change the following line of code

MacdBuffer[i]=iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i)-iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i);

to this:

MacdBuffer[i]=iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i)-iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i) -60;

It's a workaround, because when you look at the histogram, you mentally have to add 60 to the values displayed. For example, a value displayed as -20 is really +40, but you wanted it displayed below the zero line.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

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
Question about programming AMA logic into an EA zeroz Metatrader 4 mql 4 - Development course 4 12-09-2006 08:13 PM
Programming question using Close[] knili Metatrader 4 7 08-31-2006 07:35 PM
Indicator Programming Question cubesteak Indicators - Metatrader 4 5 08-05-2006 09:25 AM
a question on mt4 programming huaxia009 Metatrader 4 3 05-31-2006 03:10 AM


All times are GMT. The time now is 01:32 AM.



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