Multi Timeframe Indicators - page 80

yano125
79
yano125  

Help needed to check Code

Could somebody kindly help me check the code?

I have made several request for help to convert the RMI Indicator into MTF. However nobody seems to be interested. So I attempted to pattern the conversion to MTF based on code done for RSI.

After compiling, I get an error message for unbalanced Parenthesis. I have tried to add a parenthesis to portion where I thought I saw there was an imbalance in the setting forth of the parenthesis.

I have even tried removing parenthesis which I thought did not have any partner. Still unlucky at pinpointing the mistake.

I am attaching the code below and the actual indicators again.

CODE:

//+------------------------------------------------------------------+

//| MTF_ RMI.mq4 |

//| Copyright ?2006, DaVinciProject |

//| Forex Trading Software: Forex Trading Platform MetaTrader 4 |

//+------------------------------------------------------------------+

#property copyright "Copyright ?2006, DaVinciProject"

#property link "http://www.metaquotes.net"

#property indicator_separate_window

#property indicator_minimum 0

#property indicator_maximum 100

#property indicator_buffers 1

#property indicator_color1 DodgerBlue

#property indicator_level1 15

#property indicator_level2 85

//---- input parameters

/*************************************************************************

PERIOD_M1 1

PERIOD_M5 5

PERIOD_M15 15

PERIOD_M30 30

PERIOD_H1 60

PERIOD_H4 240

PERIOD_D1 1440

PERIOD_W1 10080

PERIOD_MN1 43200

You must use the numeric value of the timeframe that you want to use

when you set the TimeFrame' value with the indicator inputs.

**************************************************************************/

extern int TimeFrame=60;

extern int RMIPeriod=5;

extern int Shift=5;

//---- buffers

double RMIBuffer[];

double PosBuffer[];

double NegBuffer[];

//+------------------------------------------------------------------+

//| Custom indicator initialization function |

//+------------------------------------------------------------------+

int init()

{

//---- indicators

string short_name;

//---- 2 additional buffers are used for counting.

IndicatorBuffers(3);

SetIndexBuffer(1,PosBuffer);

SetIndexBuffer(2,NegBuffer);

//---- indicator line

SetIndexStyle(0,DRAW_LINE);

SetIndexBuffer(0,RMIBuffer);

//---- name for DataWindow and indicator subwindow label

switch(TimeFrame)

{

case 1 : string TimeFrameStr="Period_M1"; break;

case 5 : TimeFrameStr="Period_M5"; break;

case 15 : TimeFrameStr="Period_M15"; break;

case 30 : TimeFrameStr="Period_M30"; break;

case 60 : TimeFrameStr="Period_H1"; break;

case 240 : TimeFrameStr="Period_H4"; break;

case 1440 : TimeFrameStr="Period_D1"; break;

case 10080 : TimeFrameStr="Period_W1"; break;

case 43200 : TimeFrameStr="Period_MN1"; break;

default : TimeFrameStr="Current Timeframe";

}

IndicatorShortName("RMI ("+RMIPeriod+") "+TimeFrameStr);

}

//----

return(0);

}

//+------------------------------------------------------------------+

//| RMI - Relative Momentum Index |

//+------------------------------------------------------------------+

int start()

{

int i,counted_bars=IndicatorCounted();

double rel,negative,positive;

//----

if(Bars<=RMIPeriod) return(0);

//---- initial zero

if(counted_bars<1)

for(i=1;i<=RMIPeriod;i++) RMIBuffer=0.0;

//----

i=Bars-RMIPeriod-1;

if(counted_bars>=RMIPeriod) i=Bars-counted_bars-1;

while(i>=0)

{

double sumn=0.0,sump=0.0;

if(i==Bars-RMIPeriod-1)

{

int k=Bars-2;

//---- initial accumulation

while(k>=i)

{

rel=Close[k]-Close[k+Shift];

if(rel>0) sump+=rel;

else sumn-=rel;

k--;

}

positive=sump/RMIPeriod;

negative=sumn/RMIPeriod;

}

else

{

//---- simple moving average

rel=Close-Close;

if(rel>0) sump=rel;

else sumn=-rel;

positive=(PosBuffer*(RMIPeriod-1)+sump)/RMIPeriod;

negative=(NegBuffer*(RMIPeriod-1)+sumn)/RMIPeriod;

}

PosBuffer=positive;

NegBuffer=negative;

if(negative==0.0) RMIBuffer=0.0;

else RMIBuffer=100.0*positive/(positive+negative);

i--;

}

//----

return(0);

}

//+------------------------------------------------------------------+

//| MTF RMI |

//+------------------------------------------------------------------+

int start()

{

datetime TimeArray[];

int i,shift,limit,y=0,counted_bars=IndicatorCounted();

// Plot defined timeframe on to current timeframe

ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TimeFrame);

limit=Bars-counted_bars;

for(i=0,y=0;i<limit;i++)

{

if (Time<TimeArray[y]) y++;

/***********************************************************

Add your main indicator loop below. You can reference an existing

indicator with its iName or iCustom.

Rule 1: Add extern inputs above for all neccesary values

Rule 2: Use 'TimeFrame' for the indicator timeframe

Rule 3: Use 'y' for the indicator's shift value

**********************************************************/

ExtMapBuffer1=iRMI(NULL,TimeFrame,RMIPeriod,PRICE_CLOSE,y); //iStochastic(NULL,TimeFrame,KPeriod,DPeriod,Slowing,MAMethod,PriceField,0,y);

//ExtMapBuffer2=iStochastic(NULL,TimeFrame,KPeriod,DPeriod,Slowing,MAMethod,PriceField,1,y);

}

//

return(0);

}

//+------------------------------------------------------------------+

Files:
rmi.mq4 4 kb
Mladen Rakic
154514
Mladen Rakic  

Delete the "}" just after the

IndicatorShortName("RMI ("+RMIPeriod+") "+TimeFrameStr); line

lodol2
207
lodol2  

hi

hi right cattus would be very nice to have this Absolute S. Histogramm with the points you suggest.

Someone can do it?

fxbs
3203
fxbs  

couldn't modify AbsoluteStrength itself...dem

here's MTF AbsoluteStrength sideBar (works with AbsoluteStrength_v1.1.mq4 ) yellow dots - no trade zone (flat) - bulls and bears down under signal line

Igorad's AbsoluteStrength_v1.1 (default Mode = 0; // 0-RSI method; 1-Stoch method; 2-ADX method)

___P.S. update 20070716 : MTF_AbsoluteStrength_sBar & TF_AbsoluteStrength_v1DHs

(yellow dots TF switch fixed)

new update 20070725 post835

fxbs
3203
fxbs  

MTF_AbsoluteStrength_v1DHs.mq4; yellow dots - no trade zone

___ not standalone ind; would call

AbsoluteStrength_v1DH.mq4 ( below, same as post 783)

AbsoluteStrength_v1.1.mq4 (previous post)

AbsoluteStrength: thread -nonlagtools https://www.mql5.com/en/forum/general

P.S. update 20070716 - MTF_AbsoluteStrength_sBar & TF_AbsoluteStrength_v1DHs

(yellow dots TF switch fixed)

- new update 20070725 post835

cattus
49
cattus  

Some Errors

fxbs:
MTF_AbsoluteStrength_v1DHs.mq4; yellow dots - no trade zone

___ not standalone ind; would call

AbsoluteStrength_v1DH.mq4 ( below, same as post 783)

AbsoluteStrength_v1.1.mq4 (previous post)

AbsoluteStrength: thread -nonlagtools https://www.mql5.com/en/forum/general

Hi fxbs.

First, thank you very much for your prompt and excellent help.

Second, my apologizes because I did not explain all the cases.

I am not a coder, but anyway, I was working to do another indicator (side bars) since your first ideas "MTF_AbsoluteStrength_sBar.mq4 ". I added other cases (I attach the indicator MTF_AbsoluteStrength_sBar3.mq4). I had the same results that you had in your last indicator "MTF_AbsoluteStrength_v1DHs.mq4 ", I am talking about the warning areas, but the main problem is that your results and my results are wrong.

I had some problems to code all the cases, because the results are incorrect compared with the indicators of Igorad (please, see the pic).

The cases that I see in the use of Absolute Strenght are:

if(SmthBulls>SigBulls && SmthBears<=SigBears) TrendUpStrong=ASbarLevel;

if(SmthBulls>SigBulls && SmthBears>SigBears && ((SmthBulls-SigBulls)>(SmthBears-SigBears))) TrendUp=ASbarLevel;

if(SmthBulls>SigBulls && SmthBears>SigBears && ((SmthBulls-SigBulls)<(SmthBears-SigBears))) TrendDown=ASbarLevel;

if(SmthBullsSigBears) TrendDownStrong=ASbarLevel;

if(SmthBulls<=SigBulls && SmthBears<=SigBears) NoDirection=ASbarLevel;

if(SmthBulls>SigBulls && SmthBears>SigBears && ((SmthBulls-SigBulls)==(SmthBears-SigBears))) Volatile=ASbarLevel;

Could you please review the indicator MTF_AbsoluteStrength_sBar3.mq4? And I think that if you (or other members) are agree with all the cases that I wrote, could be better to show it in the format of your last modification of Absolute Strenght (MTF_AbsoluteStrength_v1DHs.mq4).

Regards.

spiritbreezer
259
spiritbreezer  

Mtf Fatl & Satl

Morning all, or evening

Is it possible to male MTF versions of thse 2 indicators?

Files:
fatl-kvi.ex4 5 kb
satl.ex4 8 kb
yano125
79
yano125  

Rmi

mladen:
Delete the "}" just after the IndicatorShortName("RMI ("+RMIPeriod+") "+TimeFrameStr); line

Hi mladen.

I tried deleting it. But I got more errors after trying to compile it. Did you remove it and successfully compiled it?

I tried to remove 1 "{" at a time and returned it when I still got an error. Tehn I did it for the "}" too. Still no luck. I tried adding a { or } in areas where i thought there was an imbalce... yet I still could not compile it.

But thanks anyway for looking into this.

yano

Mladen Rakic
154514
Mladen Rakic  

In addition you need yo make this

//+------------------------------------------------------------------+

//| MTF RMI |

//+------------------------------------------------------------------+

int start()

{

datetime TimeArray[];

int i,shift,limit,y=0,counted_bars=IndicatorCounted();

// Plot defined timeframe on to current timeframe

ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TimeF rame);

limit=Bars-counted_bars;

for(i=0,y=0;i<limit;i++)

{

if (Time<TimeArray[y]) y++;

/************************************************** *********

Add your main indicator loop below. You can reference an existing

indicator with its iName or iCustom.

Rule 1: Add extern inputs above for all neccesary values

Rule 2: Use 'TimeFrame' for the indicator timeframe

Rule 3: Use 'y' for the indicator's shift value

************************************************** ********/

ExtMapBuffer1=iRMI(NULL,TimeFrame,RMIPeriod,PRICE_CLOSE,y); //iStochastic(NULL,TimeFrame,KPeriod,DPeriod,Slowing ,MAMethod,PriceField,0,y);

//ExtMapBuffer2=iStochastic(NULL,TimeFrame,KPeriod,DPeriod,Slowin g,MAMethod,PriceField,1,y);

}

//

return(0);

}

//+------------------------------------------------------------------+

a separate indicator, it can not be (the way you are trying to make it) in a same source

cattus
49
cattus  

Comments

fxbs:
MTF_AbsoluteStrength_v1DHs.mq4; yellow dots - no trade zone

___ not standalone ind; would call

AbsoluteStrength_v1DH.mq4 ( below, same as post 783)

AbsoluteStrength_v1.1.mq4 (previous post)

AbsoluteStrength: thread -nonlagtools https://www.mql5.com/en/forum/general

Hi fxbs.

I was checking again your modifications of the AbsoluteStrenght and I was reviewing each one of my previous files of that indicator in order to find some errors. I found that the main problem of your last modification "MTF_AbsoluteStrength_v1DHs.mq4" is when it works like a MTF. Please, review the following picts:

I hope that this helps in something.

Thanks.

Files:
tf0.gif 38 kb
tf60-1.gif 41 kb
tf60-2.gif 38 kb