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 03-03-2006, 12:05 PM
BrunoFX's Avatar
Senior Member
 
Join Date: Sep 2005
Posts: 816
BrunoFX will become famous soon enough
Request : CCI+EMA20

Helo,

I need a piece of code to define a variable as a moving average of CCI. I use the MA applied to the CCI (using previous indicator's data) and I want to use that into an EA. How should I do it? iMA(....); ?
Thank you."
__________________
All long voyages always start from the first small steps ...
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 03-03-2006, 11:35 PM
Mohammed's Avatar
Senior Member
 
Join Date: Mar 2006
Posts: 119
Mohammed is on a distinguished road
Lightbulb

Quote:
Originally Posted by BrunoFX
Helo,

I need a piece of code to define a variable as a moving average of CCI. I use the MA applied to the CCI (using previous indicator's data) and I want to use that into an EA. How should I do it? iMA(....); ?
Thank you."
BrunoFX,
If I understand you well, this is the code:

PHP Code:
//+------------------------------------------------------------------+
//|                                                         Demo.mq4 |
//|                                                         Mohammed |
//+------------------------------------------------------------------+

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Red

extern int CCI_PERIOD=14;
extern int EMA_PERIOD=20;
//---- buffers
double Buf[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   
SetIndexStyle(0,DRAW_LINE);
   
SetIndexBuffer(0,Buf);
//----
   
return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- 
   
//----
   
return(0);
  }

int start()
  {
   
int i,limit;

   
double marray[]; 
   
   
int counted_bars=IndicatorCounted();
   if(
counted_bars>0counted_bars--;
   
limit=Bars-counted_bars;
   
   
ArrayResizemarraylimit); 
   
ArraySetAsSeries(marray,true); 



   for(
i=0i<limiti++)
   {
   
marray[i] = iCCI(NULL,0,CCI_PERIOD,PRICE_CLOSE,i);
   Print(
"marray = ",marray[i]);
   }
   for(
i=0i<limiti++)
   {
   
Buf[i] = iMAOnArray(marray,limit,EMA_PERIOD,0,MODE_EMA,i);
   }


   return(
0);

  }
//+------------------------------------------------------------------+ 
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 03-04-2006, 11:52 AM
cucurucu's Avatar
Senior Member
 
Join Date: Jan 2006
Posts: 314
cucurucu is on a distinguished road
Exclamation Hi Mohammed

I have compiled the code you've posted and I think that there is something wrong with it. Please have a look at the chart attached. In subchart 1, is CCI
with Moving Average applied to Previous indicator's data. I think that's what BrunoFX wants (and me too). In subchart 2 is your indicator along with the CCI. The settings are the same (CCI period14, EMA period 50) but the Moving averages are different. Why?

Can you please fix your indicator?

Thank you.
Attached Images
File Type: gif CCI MA.gif (8.0 KB, 205 views)
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 03-04-2006, 01:06 PM
Mohammed's Avatar
Senior Member
 
Join Date: Mar 2006
Posts: 119
Mohammed is on a distinguished road
Unhappy

Quote:
Originally Posted by cucurucu
I have compiled the code you've posted and I think that there is something wrong with it. Please have a look at the chart attached. In subchart 1, is CCI
with Moving Average applied to Previous indicator's data. I think that's what BrunoFX wants (and me too). In subchart 2 is your indicator along with the CCI. The settings are the same (CCI period14, EMA period 50) but the Moving averages are different. Why?

Can you please fix your indicator?

Thank you.
cucurucu,
I'm so sorry to hear that it didn't work.
Well, I don't understand this sentence "Moving Average applied to Previous indicator's data"
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 03-04-2006, 01:25 PM
cucurucu's Avatar
Senior Member
 
Join Date: Jan 2006
Posts: 314
cucurucu is on a distinguished road
Lightbulb It's easy

Hi Mohammed

Quote:
Well, I don't understand this sentence "Moving Average applied to Previous indicator's data"
Please click & drag the Moving Average over the CCI subchart and, in the MA properties window choose Apply to: Previous Indicator's Data (instead of Close price which is default). Using the previous indicator's data, the Moving Average will be the MA of CCI, not the MA of price.

It's important to use the Moving Average standard indicator (not custom) and to modify the Apply to:, in the moment you drop it on the CCI subchart. If you don't , the MA will appear on the price chart, using the closing price.

I hope you understand. I was kind of difficult to me too, the first time. BrunoFX explained this to me, few days ago.

Please think of something to correct the indicator.
Thank you.
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 03-04-2006, 02:15 PM
Kalenzo's Avatar
Senior Member
 
Join Date: Dec 2005
Location: Bydgoszcz - Poland
Posts: 722
Kalenzo is on a distinguished road
Quote:
Originally Posted by cucurucu
Hi Mohammed



Please click & drag the Moving Average over the CCI subchart and, in the MA properties window choose Apply to: Previous Indicator's Data (instead of Close price which is default). Using the previous indicator's data, the Moving Average will be the MA of CCI, not the MA of price.

It's important to use the Moving Average standard indicator (not custom) and to modify the Apply to:, in the moment you drop it on the CCI subchart. If you don't , the MA will appear on the price chart, using the closing price.

I hope you understand. I was kind of difficult to me too, the first time. BrunoFX explained this to me, few days ago.

Please think of something to correct the indicator.
Thank you.
Guys !
U have to use Buffers instead of normal arrays. If U do so, it will work fine !
__________________
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!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 03-04-2006, 02:21 PM
Mohammed's Avatar
Senior Member
 
Join Date: Mar 2006
Posts: 119
Mohammed is on a distinguished road
Arrow

Quote:
Originally Posted by cucurucu
Hi Mohammed



Please click & drag the Moving Average over the CCI subchart and, in the MA properties window choose Apply to: Previous Indicator's Data (instead of Close price which is default). Using the previous indicator's data, the Moving Average will be the MA of CCI, not the MA of price.

It's important to use the Moving Average standard indicator (not custom) and to modify the Apply to:, in the moment you drop it on the CCI subchart. If you don't , the MA will appear on the price chart, using the closing price.

I hope you understand. I was kind of difficult to me too, the first time. BrunoFX explained this to me, few days ago.

Please think of something to correct the indicator.
Thank you.
Well Well Well, I've found the problem.

The indicator is working well (The values are right, just watch the data window)

But it draws itself wrong (because it didn't use the same indicator_minimum and indicator_maximum settings of the CCI). This is the first well

The second well:
To make the indicator draws itself right you have to do the following:

1- Download the attached indicator.
2- Drop it to the chart.
3- Drop a CCI.
4- Open the properties window of the CCI to copy the fixed maximum and minimum values (see attached image).
5- Open the MA_CCI indicator and paste the values.
6- It will work.

The third well:
Should I have work to skip these boring steps to make the indicator draws itself right? Or you need only to know the values (which working well although the drawing in not)?
Attached Images
File Type: jpg cci_parms.JPG (51.7 KB, 188 views)
Attached Files
File Type: mq4 MA_CCI.mq4 (1.7 KB, 99 views)
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 03-04-2006, 05:45 PM
cucurucu's Avatar
Senior Member
 
Join Date: Jan 2006
Posts: 314
cucurucu is on a distinguished road
Thumbs up Thank you both

Thank you Mohammed!
You are right, the value it's ok.
There is no need to modify the indicator (for me) because I need to use it in an EA.
I don't know about BrunoFX ... but he also wants to use it for an EA, so I think this indicator would be fine for him too. Thank you.

Kalenzo, thanks for your advice. However, in the data window, I can see that the value is correct. It's all I need.

Best Regards.
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
  #9 (permalink)  
Old 03-04-2006, 05:50 PM
Mohammed's Avatar
Senior Member
 
Join Date: Mar 2006
Posts: 119
Mohammed is on a distinguished road
Talking

Quote:
Originally Posted by cucurucu
Thank you Mohammed!
You are right, the value it's ok.
There is no need to modify the indicator (for me) because I need to use it in an EA.
I don't know about BrunoFX ... but he also wants to use it for an EA, so I think this indicator would be fine for him too. Thank you.

Kalenzo, thanks for your advice. However, in the data window, I can see that the value is correct. It's all I need.

Best Regards.
I'm happy it worked !
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
  #10 (permalink)  
Old 03-06-2006, 11:47 AM
BrunoFX's Avatar
Senior Member
 
Join Date: Sep 2005
Posts: 816
BrunoFX will become famous soon enough
Thank you with all the present: Mohammed, cucurucu, and Kalenzo for your assistance.
__________________
All long voyages always start from the first small steps ...
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
EA request Alex.Piech.FinGeR Suggestions for Trading Systems 34 08-27-2007 06:30 PM
Tools request! codersguru Tools and utilities 64 09-07-2006 04:11 PM
New EA request FX-Hedger Expert Advisors - Metatrader 4 35 06-20-2006 05:44 AM
Please Script request leutzuro Tools and utilities 8 03-20-2006 09:28 AM


All times are GMT. The time now is 11:46 PM.



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