Hello
I used to trade with the repulse indicator on the metatrader platform (4).
Unfortunatelmy, it doesn't exist on FXCM platform
Could you please translate it on this one.
This indicator is used as following :
- it calculates the difference between the buying strengh and the selling strengh
- the divergence between the price et the indicator show a weakness of the price
- upper 0 line, the market is up...
- the different time (1,5,15) show the state of the market on the different scale -> it is interesting to trade a tranding range on a bollinger band when the indicator at a upper time frame is controry to the movement -> Ex : short on upper bollinger band when the repulse 5 is negative...
Best regards
Karka1
Here's the code from MT4 :
//+------------------------------------------------------------------+
//| Repulse.mq4 |
//| Fabrice Cognet |
//| |
//+------------------------------------------------------------------+
#property copyright "Eric Lefort"
#property link "http://www.pro-at.com"
#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 Gray
#property indicator_color2 Yellow
#property indicator_color3 Cyan
//---- input parameters
extern int RepulsePeriod1=1;
extern int RepulsePeriod2=5;
extern int RepulsePeriod3=15;
//---- buffers
double RepulseBuffer1[];
double RepulseBuffer2[];
double RepulseBuffer3[];
double PosBuffer[];
double NegBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init() {
string short_name;
short_name="Repulse("+RepulsePeriod1+", "+RepulsePeriod2+", "+RepulsePeriod3+")";
IndicatorShortName(short_name);
//---- indicators
IndicatorBuffers(5);
SetIndexBuffer(0,RepulseBuffer1);
SetIndexBuffer(1,RepulseBuffer2);
SetIndexBuffer(2,RepulseBuffer3);
SetIndexBuffer(3,PosBuffer);
SetIndexBuffer(4,NegBuffer);
SetIndexStyle(0,DRAW_LINE);
SetIndexStyle(1,DRAW_LINE);
SetIndexStyle(2,DRAW_LINE);
SetIndexStyle(3,DRAW_NONE);
SetIndexStyle(4,DRAW_NONE);
SetLevelValue(0,0);
SetLevelStyle(STYLE_DOT,0,DimGray);
//----
return(0);
}
//+------------------------------------------------------------------+
//| iteration function |
//+------------------------------------------------------------------+
int start() {
double forceHaussiere, forceBaissiere;
int index = 0;
int counted_bars=IndicatorCounted();
int limit = Bars - counted_bars;
// Repulse1
for(index=0;index<Bars;index++) {
PosBuffer[index] = ((((3*Close[index])-(2*getLow(index, RepulsePeriod1))-Open[index])/Close[index])*100);
NegBuffer[index] = (((Open[index]+(2*getHigh(index, RepulsePeriod1))-(3*Close[index]))/Close[index])*100);
}
for(index=0;index<limit;index++) {
forceHaussiere=iMAOnArray(PosBuffer, 0, RepulsePeriod1 * 5, 0, MODE_EMA, index);
forceBaissiere=iMAOnArray(NegBuffer, 0, RepulsePeriod1 * 5, 0, MODE_EMA, index);
RepulseBuffer1[index]=forceHaussiere-forceBaissiere;
}
// Repulse2
for(index=0;index<Bars;index++) {
PosBuffer[index] = ((((3*Close[index])-(2*getLow(index, RepulsePeriod2))-Open[index+RepulsePeriod2])/Close[index])*100);
NegBuffer[index] = (((Open[index+RepulsePeriod2]+(2*getHigh(index, RepulsePeriod2))-(3*Close[index]))/Close[index])*100);
}
for(index=0;index<limit;index++) {
forceHaussiere=iMAOnArray(PosBuffer, 0, RepulsePeriod2 * 5, 0, MODE_EMA, index);
forceBaissiere=iMAOnArray(NegBuffer, 0, RepulsePeriod2 * 5, 0, MODE_EMA, index);
RepulseBuffer2[index]=forceHaussiere-forceBaissiere;
}
// Repulse3
for(index=0;index<Bars;index++) {
PosBuffer[index] = ((((3*Close[index])-(2*getLow(index, RepulsePeriod3))-Open[index+RepulsePeriod3])/Close[index])*100);
NegBuffer[index] = (((Open[index+RepulsePeriod3]+(2*getHigh(index, RepulsePeriod3))-(3*Close[index]))/Close[index])*100);
}
for(index=0;index<limit;index++) {
forceHaussiere=iMAOnArray(PosBuffer, 0, RepulsePeriod3 * 5, 0, MODE_EMA, index);
forceBaissiere=iMAOnArray(NegBuffer, 0, RepulsePeriod3 * 5, 0, MODE_EMA, index);
RepulseBuffer3[index]=forceHaussiere-forceBaissiere;
}
return(0);
}
//+------------------------------------------------------------------+
double getLow(int from, int period) {
double low = 9999999999;
for (int index=from; index<=from+period; index++) {
if (low > Low[index]) {
low = Low[index];
}
}
return (low);
}
double getHigh(int from, int period) {
double high = 0;
for (int index=from; index<=from+period; index++) {
if (high < High[index]) {
high = High[index];
}
}
return (high);
}