Forex



Go Back   Forex Trading > Training > Metatrader > Metatrader 4 mql 4 - Development course > Questions
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 07-13-2006, 07:57 PM
Aaragorn's Avatar
Senior Member
 
Join Date: Jun 2006
Location: USA
Posts: 801
Aaragorn is on a distinguished road
Adding moving average lines to chart

I am new with drawing objects. I have an EA that uses three moving averages for trades...

I have some issues with the strategy tester always drawing two moving average lines on the charts when I open them after a test...they are not the right ma lines...

so...

I want to add the code to my EA to make it draw the MA lines I'm using as well as place the trades...

I don't really know what I'm doing with this, when I put this code in the EA it stops placing trades in the tester....

PHP Code:
   int    counted_bars=IndicatorCounted();
   
     
string ShortemaS;
     
string ShortemaL;
     
string Ctrendema;
 
//---- check for possible errors
   
if (counted_bars<0) return(-1);
//---- last counted bar will be recounted
   
if (counted_bars>0counted_bars--;
   
   
int pos=Bars-counted_bars;
   
     
 
   while(
pos>=0)
     {    
         
ExtMapBuffer1[pos]= iMA(NULL0ShortemaS0MODE_EMAPRICE_CLOSECurrent 0);
         
ExtMapBuffer2[pos]= iMA(NULL0ShortemaL0MODE_EMAPRICE_CLOSECurrent 0);
         
ExtMapBuffer3[pos]= iMA(NULL0Ctrendema0MODE_EMAPRICE_CLOSECurrent 0);
 
         
pos--;
     }   
     
//---- indicator line
          
SetIndexStyle(0,DRAW_LINESTYLE_SOLID2Green);
          
SetIndexBuffer(0,ExtMapBuffer1);
          
SetIndexStyle(0,DRAW_LINESTYLE_SOLID2Yellow);
          
SetIndexBuffer(0,ExtMapBuffer2);
          
SetIndexStyle(0,DRAW_LINESTYLE_SOLID2Red);
          
SetIndexBuffer(0,ExtMapBuffer3);
      return(
0); 
It doesn't draw the lines either so I know I've not got it hooked up right.

please advise.

Last edited by Aaragorn; 07-13-2006 at 08:19 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
  #2 (permalink)  
Old 07-14-2006, 05:41 AM
Member
 
Join Date: Mar 2006
Posts: 49
pipeline is on a distinguished road
I haven't tried it but in my mind EAs are not designed to draw stuff on the chart, indicators are. So I draw non built-in MAs with an indicator.

You have declared but not initialized your string variables: they're empty strings (""). So the iCustom() won't know which .ex4 file to open.

I see no reason why the "indicator line" section sould be in start{} rather than in init{}.
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
How to calculate Moving Average of a Moving Average babarmughal Expert Advisors - Metatrader 4 4 05-31-2009 03:05 PM
Adding price to MA on chart techtrader Indicators - Metatrader 4 0 03-06-2007 10:06 PM
Adding Histogram to a Chart aparsai Metatrader 4 4 07-07-2006 08:13 PM
Error adding EA to chart GoatT Expert Advisors - Metatrader 4 10 06-08-2006 01:59 AM


All times are GMT. The time now is 03:26 PM.



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