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 06-28-2007, 10:47 AM
mikep's Avatar
Member
 
Join Date: Jun 2006
Posts: 86
mikep is on a distinguished road
Elder's Market Thermometer

Hello All,

I'm trying to program Elder's Market Thermometer and have the basic calculations and drawing correct to measure "temperature".
However, actually getting the indicator to draw a MA on top seems to be an issue.

I've attached a screen shot where I just used the temperature then manually overlayed a MA ontop vs the bottom where I tried my hand at programming it into the indicator automatically.

It's part of a larger system (all based on Elder's 3 screens) and seems to work quite well.

I'm using it to exit trades when the temperature is 3.5 times the MA.
I'm also playing with it to enter trades - if temperature is 3 times the MA, take trade in direction of longer TF (only if price is below chart MA for a long, for example).

The code is super simple, but even so I can't figure it out - can someone take 3 minutes to check it out and fix the issue?

I've attached a screen shot to show the issue.

Code:
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Black
#property indicator_color2 Red
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];

extern int ThermoMAPeriod = 13;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_HISTOGRAM);
   SetIndexBuffer(0,ExtMapBuffer1);
   
   SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,2);
   SetIndexBuffer(1,ExtMapBuffer2);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   
   int    i,limit;
   double thermo, ma;
   
   limit=Bars-1;
   for(i=0;i<limit;i++) {
    
   
    thermo = MathMax(iHigh(NULL,0,i) - iHigh(NULL,0,i+1), iLow(NULL,0,i+1) - iLow(NULL,0,i));
     
     if (thermo < 0) {thermo = 0;}
     
     ma = iMAOnArray(thermo,0,ThermoMAPeriod,0,MODE_EMA,i);
       
     ExtMapBuffer1[i]=thermo;
     ExtMapBuffer2[i]=ma;
     }
     
     
   return(0);
  }
//+------------------------------------------------------------------+
Attached Images
File Type: gif marketthermo test.gif (14.9 KB, 821 views)
__________________
--------------------------------------------------
"Treat people as if they were what they ought to be and help them become what they are capable of being." Goethe
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, 10:49 AM
mikep's Avatar
Member
 
Join Date: Jun 2006
Posts: 86
mikep is on a distinguished road
...and here is the file...
Attached Files
File Type: mq4 Market Thermometer v2.mq4 (2.0 KB, 89 views)
__________________
--------------------------------------------------
"Treat people as if they were what they ought to be and help them become what they are capable of being." Goethe
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 06-28-2007, 12:00 PM
HerbertH's Avatar
Member
 
Join Date: May 2006
Posts: 88
HerbertH is on a distinguished road
Fixed

Quote:
Originally Posted by mikep View Post
...and here is the file...
2 problems found:
- iMAOnArray can only be used on an array and you were using the simple variable thermo instead.
- iMAOnArray can only be used on a prepared (filled) array. So it can only be executed after the first loop.

Cheers,
Herbert
Attached Files
File Type: mq4 Market Thermometer v2.mq4 (2.0 KB, 114 views)
__________________
Better being out wishing to be in, than being in wishing to be out.....
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 06-28-2007, 12:09 PM
Senior Member
 
Join Date: Feb 2006
Posts: 587
Michel is on a distinguished road
the array is "ExtMapBuffer1", not "thermo" !
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
  #5 (permalink)  
Old 06-28-2007, 12:15 PM
Senior Member
 
Join Date: Feb 2006
Posts: 587
Michel is on a distinguished road
Herberth,
You are faster !
but you also can do this (from left to right):
PHP Code:
   for(i=limit-1;i>=0;i--) { 
   
    
thermo MathMax(iHigh(NULL,0,i) - iHigh(NULL,0,i+1), iLow(NULL,0,i+1) - iLow(NULL,0,i));
     
     if (
thermo 0) {thermo 0;}
     
     
ExtMapBuffer1[i]=thermo;
     
     
ExtMapBuffer2[i]=iMAOnArray(ExtMapBuffer1,0,ThermoMAPeriod,0,MODE_EMA,i);
     } 
It seems better as value of bar i+1 is used to calculate value of bar i

Last edited by Michel; 06-28-2007 at 12:18 PM.
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
  #6 (permalink)  
Old 06-28-2007, 12:32 PM
HerbertH's Avatar
Member
 
Join Date: May 2006
Posts: 88
HerbertH is on a distinguished road
Quote:
Originally Posted by Michel View Post
Herberth,
You are faster !
but you also can do this (from left to right):
PHP Code:
   for(i=limit-1;i>=0;i--) { 
   
    
thermo MathMax(iHigh(NULL,0,i) - iHigh(NULL,0,i+1), iLow(NULL,0,i+1) - iLow(NULL,0,i));
     
     if (
thermo 0) {thermo 0;}
     
     
ExtMapBuffer1[i]=thermo;
     
     
ExtMapBuffer2[i]=iMAOnArray(ExtMapBuffer1,0,ThermoMAPeriod,0,MODE_EMA,i);
     } 
It seems better as value of bar i+1 is used to calculate value of bar i
Correct Michel it's always better to go from left to right, one important reason
for that is to prevent re-painting of the indi.

Regards
__________________
Better being out wishing to be in, than being in wishing to be out.....
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
  #7 (permalink)  
Old 06-28-2007, 02:56 PM
mikep's Avatar
Member
 
Join Date: Jun 2006
Posts: 86
mikep is on a distinguished road
Thanks for the quick response!!

I appreciate it, now I can review my mistakes and hopefully not repeat them!

Mike
__________________
--------------------------------------------------
"Treat people as if they were what they ought to be and help them become what they are capable of being." Goethe
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
  #8 (permalink)  
Old 08-22-2008, 11:10 AM
Administrator
 
Join Date: Sep 2005
Posts: 20,079
Blog Entries: 241
newdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud of
Elders market thermometer - from "Come in my trading room" - a real classic: good indicator coded by mladen.
__________________
My blog on TSD
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

Tags
market thermometer, Elders Market Thermometer, elder, elder market thermometer, Elder Thermometer, imaonarray


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
When Does Market Open? mikejody General Discussion 2 01-01-2007 07:20 PM
What a morning market. goover General Discussion 29 06-13-2006 03:50 AM


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



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