Hi and Happy Easter....
Could you add 2 buffers on FRAMA_MBK ehlers (that I copy below)....DOWN ARROW WHEN SIGNAL CROSS DOWN THE FRAMA and UP ARROW WHEN SIGNAL CROSS UP THE FRAMA?
Regards....
FRAMA_MBK ehlers:
//---- indicator settings
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Blue
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
extern int RPeriod = 16;
extern double multiplier = 4.6;
extern double signal_multiplier = 2.5;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- 1 additional buffers are used for counting.
IndicatorBuffers(2);
//---- drawing settings
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2);
SetIndexShift(0,0);
IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS));
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,2);
SetIndexShift(1,0);
//---- initialization done
return(0);
}
int start()
{
int i,k,counted_bars=IndicatorCounted();
if (Bars < RPeriod) return(0);
Comment("Bars : ",Bars);
int maxshift = Bars-RPeriod-1;
int limit= maxshift - counted_bars;
if (limit < 1) limit = 1;
int N = MathFloor(RPeriod/2)*2; // Force N to even number
double frama = Close[maxshift];
double signal = frama;
ExtMapBuffer1[maxshift] = Close[maxshift];
ExtMapBuffer2[maxshift] = Close[maxshift];
for(int shift = limit-1; shift >= 0; shift--) {
double dimension_estimate = DEst(shift,N);
double alpha = MathExp(-multiplier*(dimension_estimate-1.0));
double alphas = MathExp(-signal_multiplier*(dimension_estimate-1.0));
if (alpha > 1.0) alpha = 1.0;
if (alpha < 0.01) alpha = 0.01;
if (alphas > 1.0) alphas = 1.0;
if (alphas < 0.01) alphas = 0.01;
frama = alpha* Close[shift] + (1.0-alpha)* ExtMapBuffer1[shift+1];
signal = alphas * frama + (1.0 - alphas)* ExtMapBuffer2[shift+1];
ExtMapBuffer1[shift] = frama;
ExtMapBuffer2[shift] = signal;
}
return(0);
}
double DEst(int shift, int n) {
//
double R1, R2, R3;
int n2 = n/2;
R3 = Range(shift,n) / n;
R1 = Range(shift,n2) / n2;
R2 = Range(shift+n2,n2) / n2;
return( (MathLog(R1+R2)-MathLog(R3) )* 1.618 ) ; // log_2(e) = 1.618
}
double Range(int i, int k) {
return( High[Highest(NULL,0,MODE_HIGH,k,i)] - Low[Lowest(NULL,0,MODE_LOW,k,i)] );
}
Forward Message

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I've modified FRAMA indi in FRAMAOsma but I've two problems....
1) the values of osma compared to the values of frama and signal are too small and I can't see any of the 3 values.
2) when I change time-frame or re-start metatrader program, the history of OSMA histogram disappears.
the code is right...
.......where do I wrong?!?
Thanks for yours helping!
:-)
//---- indicator settings
#property indicator_separate_window
#property indicator_buffers 4
#property indicator_color1 Red
#property indicator_color2 Lime
#property indicator_color3 Red
#property indicator_color4 Lime
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
extern int RPeriod = 16;
extern double multiplier = 4.6;
extern double signal_multiplier = 2.5;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- 1 additional buffers are used for counting.
IndicatorBuffers(4);
//---- drawing settings
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2);
SetIndexShift(0,0);
IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS));
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,2);
SetIndexShift(1,0);
SetIndexBuffer(2,ExtMapBuffer3);
SetIndexStyle (2,DRAW_HISTOGRAM);
SetIndexShift(2,0);
SetIndexBuffer(3,ExtMapBuffer4);
SetIndexStyle (3,DRAW_HISTOGRAM);
SetIndexShift(3,0);
//---- initialization done
return(0);
}
int start()
{
int i,k,counted_bars=IndicatorCounted();
if (Bars < RPeriod) return(0);
Comment("Bars : ",Bars);
int maxshift = Bars-RPeriod-1;
int limit= maxshift - counted_bars;
if (limit < 1) limit = 1;
int N = MathFloor(RPeriod/2)*2; // Force N to even number
double frama = Close[maxshift];
double signal = frama;
ExtMapBuffer1[maxshift] = Close[maxshift];
ExtMapBuffer2[maxshift] = Close[maxshift];
for(int shift = limit-1; shift >= 0; shift--) {
double dimension_estimate = DEst(shift,N);
double alpha = MathExp(-multiplier*(dimension_estimate-1.0));
double alphas = MathExp(-signal_multiplier*(dimension_estimate-1.0));
if (alpha > 1.0) alpha = 1.0;
if (alpha < 0.01) alpha = 0.01;
if (alphas > 1.0) alphas = 1.0;
if (alphas < 0.01) alphas = 0.01;
frama = alpha* Close[shift] + (1.0-alpha)* ExtMapBuffer1[shift+1];
signal = alphas * frama + (1.0 - alphas)* ExtMapBuffer2[shift+1];
ExtMapBuffer1[shift] = frama;
ExtMapBuffer2[shift] = signal;
ExtMapBuffer3[shift] = EMPTY_VALUE;
ExtMapBuffer4[shift] = EMPTY_VALUE;
double FRAMAOsma = (ExtMapBuffer1[shift]-ExtMapBuffer2[shift]);
if(FRAMAOsma > 0)
ExtMapBuffer3 = FRAMAOsma;
else ExtMapBuffer4 = FRAMAOsma;
}
return(0);
}
double DEst(int shift, int n) {
//
double R1, R2, R3;
int n2 = n/2;
R3 = Range(shift,n) / n;
R1 = Range(shift,n2) / n2;
R2 = Range(shift+n2,n2) / n2;
return( (MathLog(R1+R2)-MathLog(R3) )* 1.442695 ) ; // log_2(e) = 1.442694
}
double Range(int i, int k)
{
return( High[Highest(NULL,0,MODE_HIGH,k,i)] - Low[Lowest(NULL,0,MODE_LOW,k,i)] );
}
__________________