| New signals service! | |
|
|||||||
| 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 |
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
||||
|
Quote:
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 |
|
||||
|
Quote:
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. |
|
||||
|
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 |
|
||||
|
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 08:27 PM. |
|
||||
|
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 05:34 AM. |
|
||||
|
Adding indi to the same window.
Quote:
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 |
|
||||
|
Quote:
Thank you for the help Peace out |
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Help with adding colour to TSI indicator | drgoodvibe | Indicators - Metatrader 4 | 3 | 11-26-2006 04:18 AM |
| help adding indicator as filter and to modify EAs | Aaragorn | Setup Questions | 24 | 06-30-2006 10:01 AM |
| Help Adding Indicator To Expert | jpsdyb | Setup Questions | 11 | 06-29-2006 02:42 AM |
| problem with adding indicator | shiningstar | Indicators - Metatrader 4 | 11 | 05-19-2006 03:25 PM |
| Help adding OBJ_TREND to indicator | nicugh | Setup Questions | 0 | 02-03-2006 06:18 PM |