Forex



Go Back   Forex Trading > Discussion Areas > 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 09-06-2006, 05:07 PM
PeaceLover's Avatar
Senior Member
 
Join Date: Aug 2006
Posts: 211
PeaceLover is on a distinguished road
Adding MA to an Indicator

If someone would be kind enough to help me here. I want to add a moving average to CCI, Stochastic and MACD. But as I am new to this system I cannot figure it out. I know it can be done. Any help would be greatly appriecated
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 09-06-2006, 05:12 PM
codersguru's Avatar
Senior Member
 
Join Date: Oct 2005
Posts: 994
codersguru has a spectacular aura aboutcodersguru has a spectacular aura aboutcodersguru has a spectacular aura about
Cool

Quote:
Originally Posted by PeaceLover
If someone would be kind enough to help me here. I want to add a moving average to CCI, Stochastic and MACD. But as I am new to this system I cannot figure it out. I know it can be done. Any help would be greatly appriecated
Hi PeaceLover,

Very good nick name!

Do you mean you want to get the moving average of CCI,Stochastic and MACD main indicator value? If yes! Please go to this article:
http://www.metatrader.info/node/84
__________________
Hope it helps !
Coders' Guru
Senior MQL programmer:
www.xpworx.com/custom.htm
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 09-06-2006, 10:53 PM
PeaceLover's Avatar
Senior Member
 
Join Date: Aug 2006
Posts: 211
PeaceLover is on a distinguished road
Quote:
Originally Posted by codersguru
Hi PeaceLover,

Very good nick name!

Do you mean you want to get the moving average of CCI,Stochastic and MACD main indicator value? If yes! Please go to this article:
http://www.metatrader.info/node/84
Codersguru
Thank you for the quick reply. I did see the link but could not understand how to get it done. Please keep in mind that I am new to this system.
Once again thank you for the info.
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 09-17-2006, 02:50 PM
kappari's Avatar
Member
 
Join Date: Jun 2006
Posts: 97
kappari is on a distinguished road
Please

how to drag the moving average ?
should we hold "shift" botton or somthing
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 09-17-2006, 10:18 PM
cja's Avatar
cja cja is offline
Senior Member
 
Join Date: Apr 2006
Posts: 676
cja is on a distinguished road
Adding MA

Quote:
Originally Posted by PeaceLover
If someone would be kind enough to help me here. I want to add a moving average to CCI, Stochastic and MACD. But as I am new to this system I cannot figure it out. I know it can be done. Any help would be greatly appriecated
If you mean that you have CCI, Stochastic or MACD already displayed and you want to add a MA to the existing indicators displayed. Open up the Navigator tree on the left of the chart select Moving Average ( out of the INDICATORS not CUSTOM INDICATORS ) by clicking left mouse button once, Now click and hold down the left mouse button on the highlighted indicator in the list and drag the small rectangle symbol over to the displayed indicator window and release the mouse button, a box will appear , select Parameters and go to the Apply to box, next select Previous Indicator Data and click OK and there you have it.
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 09-18-2006, 02:50 AM
lowphat's Avatar
Senior Member
 
Join Date: Sep 2005
Posts: 200
lowphat is on a distinguished road
heres a cci with MA i was tring to make awhile back it has some redundant code but should work. ill rewrite it when i get some time
http://www.forex-tsd.com/attachment....2&d=1158543870
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 09-18-2006, 05:04 AM
accrete's Avatar
Member
 
Join Date: Jan 2006
Location: The WET! Coast of Oregon, USA
Posts: 69
accrete is on a distinguished road
Question CG...Can this work??

Greetings all.

Ahamed, i read your article (and am going through your course, great info!)

[i wanted to add this PostScript as LowPhat figured it out and added his post w/the correction. Thank you all.]

I followed the directions in your article posted above on placing an MA on an indicator. I known that this code i've posted below is very, very close. Is it possible to point out what needs to be tweaked for the MA to show up? There are no errors listed, but i'm not seeing the moving average of the RSI. I wanted to use it as a signal line. I was able to add a second set of Bollinger Bands, and also place a second RSI line drawn in dots for use as a visual on candle close...Then the signal line was going to be based on the RSI. . .I know it is something simple i'm missing.

The signal buffer i named : "SignalMABuf", and also have an extern named "SignalMAPeriod" in case one wishes to change the MA period.

The line of code i inserted thanks to your article is this:

SignalMABuf[i]=iMAOnArray(RSIBuf,0,SignalMAPeriod,0,MODE_EMA,i);


Thanks in advance for your time and insights : )

: ) Thom

Here is the whole code:

Code:
/*+---------------------------------------------------------------------------------+
  | Original file from Dynamic Zone RSI.mq4 polk@alba.dp.ua  © 2005, Pavel Kulko    |
  |  Modyfied with Dual BBands, RSI Reversal Indicator Dots & Signal Line           |
  |  By Accrete at accrete.com c2006   Dynamic Zone RSI DualBBtrigger               |
  +---------------------------------------------------------------------------------+
*/
#property copyright "Copyright © 2005, Pavel Kulko"
#property link      "polk@alba.dp.ua"
#property indicator_buffers 7
#property indicator_color1 Lime
#property indicator_color2 Red
#property indicator_color3 Blue
#property indicator_color4 Red
#property indicator_color5 Blue
#property indicator_color6 Aqua
#property indicator_color7 Yellow

#property indicator_separate_window

extern int RSIPeriod = 8;
extern int SignalMAPeriod=8;
extern int BandPeriod = 21;

double RSIBuf[],UpZone[],DnZone[],UpZonei[],DnZonei[],RSIBufdot[],SignalMABuf[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,RSIBuf);
   
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,UpZone);
      
   SetIndexStyle(2,DRAW_LINE);
   SetIndexBuffer(2,DnZone);
   
   SetIndexStyle(3,DRAW_LINE,2,1);
   SetIndexBuffer(3,UpZonei);
      
   SetIndexStyle(4,DRAW_LINE,2,1);
   SetIndexBuffer(4,DnZonei);
          
   SetIndexStyle(5,DRAW_ARROW, EMPTY);
   SetIndexArrow(5,115);
   SetIndexBuffer(5,RSIBufdot);
   
   SetIndexStyle(6,DRAW_LINE,2,1);
   SetIndexBuffer(6,SignalMABuf);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- 
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   double MA, RSI[];
   ArrayResize(RSI,BandPeriod);
   int counted_bars=IndicatorCounted();
   int limit = Bars-counted_bars-1;
   for(int i=limit; i>=0; i--)
   {
      RSIBuf[i] = iRSI(NULL,0,RSIPeriod,MODE_CLOSE,i);
      MA = 0;
      for(int j=i; j<i+BandPeriod; j++) {
         RSI[j-i] = RSIBuf[j];
         MA += RSIBuf[j]/BandPeriod;
      }
         {
      RSIBufdot[i] = iRSI(NULL,0,RSIPeriod,MODE_CLOSE,i);
      }
      UpZone[i] = MA + (1.3185 * StDev(RSI,BandPeriod));
      DnZone[i] = MA - (1.3185 * StDev(RSI,BandPeriod));
      UpZonei[i] = MA + (0.68 * StDev(RSI,BandPeriod));
      DnZonei[i] = MA - (0.68 * StDev(RSI,BandPeriod));   
   }
            {
      SignalMABuf[i]=iMAOnArray(RSIBuf,0,SignalMAPeriod,0,MODE_EMA,i);

      }
   
//----
   return(0);
  }
  
double StDev(double& Data[], int Per)
{
  return(MathSqrt(Variance(Data,Per)));
}

double Variance(double& Data[], int Per)
{
  double sum, ssum;
  for (int i=0; i<Per; i++)
  {
    sum += Data[i];
    ssum += MathPow(Data[i],2);
  }
  return((ssum*Per - sum*sum)/(Per*(Per-1)));
}
//+------------------------------------------------------------------+
__________________
Find a way to make someone's day

Last edited by accrete; 09-18-2006 at 09:27 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
  #8 (permalink)  
Old 09-18-2006, 05:23 AM
lowphat's Avatar
Senior Member
 
Join Date: Sep 2005
Posts: 200
lowphat is on a distinguished road
looks like you closed your for i loop before placing your imonarray
so u could do something like
Code:
int start()
  {
   double MA, RSI[];
   ArrayResize(RSI,BandPeriod);
   int counted_bars=IndicatorCounted();
   int limit = Bars-counted_bars-1;
   for(int i=limit; i>=0; i--)
   {
      RSIBuf[i] = iRSI(NULL,0,RSIPeriod,MODE_CLOSE,i);
      MA = 0;
      for(int j=i; j<i+BandPeriod; j++) {
         RSI[j-i] = RSIBuf[j];
         MA += RSIBuf[j]/BandPeriod;
      }
         {
      RSIBufdot[i] = iRSI(NULL,0,RSIPeriod,MODE_CLOSE,i);
      }
      UpZone[i] = MA + (1.3185 * StDev(RSI,BandPeriod));
      DnZone[i] = MA - (1.3185 * StDev(RSI,BandPeriod));
      UpZonei[i] = MA + (0.68 * StDev(RSI,BandPeriod));
      DnZonei[i] = MA - (0.68 * StDev(RSI,BandPeriod));   
   }
      for(i=limit; i>=0; i--) 
            {
      SignalMABuf[i]=iMAOnArray(RSIBuf,0,SignalMAPeriod,0,MODE_EMA,i);
            }

Last edited by lowphat; 09-18-2006 at 06:34 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
  #9 (permalink)  
Old 09-18-2006, 07:15 AM
PeaceLover's Avatar
Senior Member
 
Join Date: Aug 2006
Posts: 211
PeaceLover is on a distinguished road
Adding indi to the same window.

Quote:
Originally Posted by kappari
Please

how to drag the moving average ?
should we hold "shift" botton or somthing
Ok, this is what I found out and thanks to the guy who answered my request.
press Ctrl + N
select the indi from the window and click and drag it to the indi window you want it on. If you are adding a moving average on the 3 option in the setup window select previous indicator.


Hope this helps
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 09-18-2006, 07:16 AM
PeaceLover's Avatar
Senior Member
 
Join Date: Aug 2006
Posts: 211
PeaceLover is on a distinguished road
Quote:
Originally Posted by cja
If you mean that you have CCI, Stochastic or MACD already displayed and you want to add a MA to the existing indicators displayed. Open up the Navigator tree on the left of the chart select Moving Average ( out of the INDICATORS not CUSTOM INDICATORS ) by clicking left mouse button once, Now click and hold down the left mouse button on the highlighted indicator in the list and drag the small rectangle symbol over to the displayed indicator window and release the mouse button, a box will appear , select Parameters and go to the Apply to box, next select Previous Indicator Data and click OK and there you have it.

Thank you for the help

Peace 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
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
Help with adding colour to TSI indicator drgoodvibe Indicators - Metatrader 4 3 11-26-2006 05:18 AM
help adding indicator as filter and to modify EAs Aaragorn Setup Questions 24 06-30-2006 11:01 AM
Help Adding Indicator To Expert jpsdyb Setup Questions 11 06-29-2006 03:42 AM
problem with adding indicator shiningstar Indicators - Metatrader 4 11 05-19-2006 04:25 PM
Help adding OBJ_TREND to indicator nicugh Setup Questions 0 02-03-2006 07:18 PM


All times are GMT. The time now is 05:58 AM.



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