Indicators: Currency Strength Index (CSI)

 

Currency Strength Index (CSI):

Trading the STRONG against the weak!

Currency Strength Index (CSI)

Author: amrali

 

Good day Amrali, thank you for the MT5 currency strength indicator. I am new to FX, and still finding my way around. Your currency strength meter does not save levels, whenever the platform is launched, the levels are non existent, any fix to this, or am doing something incorrect?

Thanks


David

 

Hello,


Do have the same indicator that works for Mt4?

 
I would suggest observe this indicator keeping records daily(hour by hour), Monthly, Weekly, all time frames at same time, then built your bot or manual strategy. This is the only Indicator that really gives an hedge.
 
fbelmonte:

Hello,


Do have the same indicator that works for Mt4?

Yes, but is a about 50 USD you can find here https://training.completecurrencytrader.com/  I used to have this mt4 indicator. 

 
Automated-Trading:

Currency Strength Index (CSI):

Author: amrali

 Amrali - you made a great job. Please fix the colors/width and style which are not working. This indicator mt4 was for sale for about 50 USD at Complete Currency Trade(London) - Now you made it at mt5 you should charge for this indicator about 60 USD a piece. Good Luck.

 
Automated-Trading:

Currency Strength Index (CSI):

Author: amrali

I commend you, sir. This indicator is just what I have been looking for, and had been unsuccessful in getting to work myself in MT5. I am a trend follower and use this to build and manage a Forex long-term trading portfolio. It does take a bit of time to load when I first add it to a chart(I thought it had crashed MT5 the first time, but tried again and waited) It has worked fine, so far, once the data loaded. Well done.
 
Robert Donovan:
I commend you, sir. This indicator is just what I have been looking for, and had been unsuccessful in getting to work myself in MT5. I am a trend follower and use this to build and manage a Forex long-term trading portfolio. It does take a bit of time to load when I first add it to a chart(I thought it had crashed MT5 the first time, but tried again and waited) It has worked fine, so far, once the data loaded. Well done.
So better use larger time frames
 
Amrali # : Portanto, é melhor usar prazos maiores

Hello Amrali. I understand very little about programming, is it possible to put this indicator inside an EA? no averages, just calculations. 

Thanks

 

Hi Amrali,

I am trying to get the values from your Currency  Strength Index into another custom indicator. My goal is to calculate bollinger bands around the strength of one currency, let's say EUR.

But I am  not succesful in obtaining any meaningful values out of your indicator. I am putting the code below. I added other (custom) indicator values (RSI, MA of RSI) to confirm that the indicator generate data.

Can you tell me where I am going wroing?

Thank you enormously! W.

#property copyright "Copyright 2018, MetaQuotes Software Corp."
#property link      "https://mql5.com"
#property version   "1.00"
#property description "BB on Indicator"
#property indicator_separate_window
#property indicator_buffers 5
#property indicator_plots   5
#property indicator_level1 30
#property indicator_level2 70
#property indicator_levelcolor clrBlack
#property indicator_minimum 0
#property indicator_maximum 100


//--- plot Bollinger Bands
#property indicator_label1  "Upper Band"
#property indicator_type1   DRAW_LINE
#property indicator_color1  clrGreen
#property indicator_style1  STYLE_DASH
#property indicator_width1  2

#property indicator_label2  "Lower Band"
#property indicator_type2   DRAW_LINE
#property indicator_color2  clrRed
#property indicator_style2  STYLE_DASH
#property indicator_width2  2

#property indicator_label3  "Moving Average"
#property indicator_type3   DRAW_LINE
#property indicator_color3  clrOrange
#property indicator_style3  STYLE_SOLID
#property indicator_width3  2

#property indicator_label4  "RSI"
#property indicator_type4   DRAW_LINE
#property indicator_color4  clrBlue
#property indicator_style4  STYLE_SOLID
#property indicator_width4  2

#property indicator_label5  "Strength"
#property indicator_type5   DRAW_LINE
#property indicator_color5  clrPurple
#property indicator_style5  STYLE_DASHDOTDOT
#property indicator_width5  8

//--- input parameters
input uint                 InpPeriodMA       =  14;            // Smoothing period
input double               InpStdBands       =  3.0; 
input ENUM_MA_METHOD       InpMethod         =  MODE_SMA;      // Smoothing method
input ENUM_APPLIED_PRICE   InpAppliedPrice   =  PRICE_CLOSE;   // Applied price (if necessary)

//--- indicator buffers
//for plotting
double BufferUpperBand[];
double BufferLowerBand[];
double BufferMA[];
double BufferRSI[];
double BufferStrength[];

//for calculations
//...


//--- global variables
int            GlobalPeriodMA;
int            GlobalStdBands;
int            GlobalPeriodRSI;
int            period_max;
int            handleBB; 
int            handleRSI; 
int            handleStrength;
//--- includes
#include <MovingAverages.mqh>
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- set global variables
   GlobalPeriodMA=int (InpPeriodMA<1 ? 1 : InpPeriodMA); //? : = if else
   GlobalStdBands=double (InpStdBands<1.0 ? 1.0 : InpStdBands);
   GlobalPeriodRSI=14;
   period_max=(int)fmax(GlobalPeriodMA,2);
//--- indicator buffers mapping
   SetIndexBuffer(0,BufferUpperBand,INDICATOR_DATA);
   SetIndexBuffer(1,BufferLowerBand,INDICATOR_DATA);  
   SetIndexBuffer(2,BufferMA,INDICATOR_DATA);
   SetIndexBuffer(3,BufferRSI,INDICATOR_DATA);
   SetIndexBuffer(4,BufferStrength,INDICATOR_DATA);
   
   
//--- setting indicator parameters
   IndicatorSetString(INDICATOR_SHORTNAME,"EDIT: MA("+(string)GlobalPeriodMA+") Std("+(string)GlobalStdBands+")");
   IndicatorSetInteger(INDICATOR_DIGITS,Digits());
//--- setting plot buffer parameters
 //  PlotIndexSetInteger(0,PLOT_DRAW_BEGIN,GlobalPeriodMA);
 //  PlotIndexSetInteger(3,PLOT_DRAW_BEGIN,GlobalPeriodRSI);
//--- setting buffer arrays as timeseries
   ArraySetAsSeries(BufferLowerBand,true);
   ArraySetAsSeries(BufferUpperBand,true);
   ArraySetAsSeries(BufferMA,true);
   ArraySetAsSeries(BufferRSI,true);
   ArraySetAsSeries(BufferStrength,true);
//--- create RSI's handles
   ResetLastError();
   //handle=iCustom(_Symbol,PERIOD_CURRENT,"RSI_MA",14,2); //laatste is ma type?
   //Example with non custom indicator: 
   handleRSI=iRSI(NULL,PERIOD_CURRENT,GlobalPeriodRSI,InpAppliedPrice); 
   handleStrength=iCustom(NULL,0,"CURRENCY_STRENGTH_INDEX",20,1,true,true,true,true,true,true,true,true);
   handleStrength=iCustom(NULL,0,"RSI_MA",14,PRICE_CLOSE,28,MODE_SMA);
   handleBB=iBands(NULL,PERIOD_CURRENT,GlobalPeriodMA,0,2,handleRSI);
   
   //The handle points to the indicator
   //We always need a handle to refer to. Mq5 cannot refer directly to the indicator.
   
   //Error handling if the hande does is not created/does not exist.
   if(handleRSI==INVALID_HANDLE)
     {
      Print("The CustomIndicator( RSI",(string)GlobalPeriodRSI,") object was not created: Error ",GetLastError());
      return INIT_FAILED;
     }
      if(handleBB==INVALID_HANDLE)
     {
      Print("The CustomIndicator( BB",(string)GlobalPeriodMA,") object was not created: Error ",GetLastError());
      return INIT_FAILED;
     }  
           if(handleStrength==INVALID_HANDLE)
     {
      Print("The CustomIndicator( Strength",(string)GlobalPeriodMA,") object was not created: Error ",GetLastError());
      return INIT_FAILED;
     }  
     
     
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const int begin,
                const double &price[])
                
                
  {
  //--- flag for one-time displaying of values of price[]
   static bool printed=false;
//--- if begin is not equal to zero, then there values that we shouldn't take into consideration
   if(begin>0 && !printed)
     {
      //--- display
     Print("Values for calculation start from the index begin =",begin,
            "   size of the array price[] =",rates_total);

      //--- let's see how the values that shouldn't be taken for calculations look like
      for(int i=0;i<=begin;i++)
        {
       //  Print("i =",i,"  value =",price[i]);
        }
      //--- set an attribute that the values have been already displayed in the log
      printed=true;
     }
  
  
  
//--- checking and calculating the number of counted bars
   if(rates_total<fmax(GlobalPeriodMA+GlobalPeriodRSI,4)) return 0;  
//--- checking and calculating the number of counted bar
   int limit=rates_total-prev_calculated;

 
 
   if(limit>1)
     {
      limit=rates_total-1;
      //Print("print limit2 ",limit );
      ArrayInitialize(BufferRSI,0);
      ArrayInitialize(BufferUpperBand,EMPTY_VALUE);//0 doest solve inf issue
      ArrayInitialize(BufferLowerBand,EMPTY_VALUE);//0 doest solve inf issue 
      ArrayInitialize(BufferMA,EMPTY_VALUE);//0 doest solve inf issue
      ArrayInitialize(BufferStrength,EMPTY_VALUE);
     }
//--- Data prepping
   int count=(limit>1 ? rates_total : 1),copiedRSI=0;
   copiedRSI=CopyBuffer(handleRSI,0,0,count,BufferRSI); 
   copiedRSI=CopyBuffer(handleBB,0,0,count,BufferMA);
   copiedRSI=CopyBuffer(handleBB,1,0,count,BufferUpperBand);   
   copiedRSI=CopyBuffer(handleBB,2,0,count,BufferLowerBand);   
   copiedRSI=CopyBuffer(handleStrength,0,0,count,BufferStrength);        
   if(copiedRSI!=count) return 0;

  

   



   return(rates_total);
  }
 
WillowTrader #:

Hi Amrali,

I am trying to get the values from your Currency  Strength Index into another custom indicator. My goal is to calculate bollinger bands around the strength of one currency, let's say EUR.

But I am  not succesful in obtaining any meaningful values out of your indicator. I am putting the code below. I added other (custom) indicator values (RSI, MA of RSI) to confirm that the indicator generate data.

Can you tell me where I am going wroing?

Thank you enormously! W.

Hello,

Please show me your code with CSI.

My indicator seems to need time for loading all symbols. I don't know if this is the cause or not.
Reason: