what is wrong with this superposition

 

hello

i am trying to combine rsi+demark to creat new oscillator

main caculation is like this :

for(int shift=0; shift<size; shift++)
     {
      RSI_Handle[shift]=
      (
      (iRSI("GBPCAD.e",PERIOD_CURRENT,StartLength+shift,Applied_Price))+
      (100*(iDeMarker("GBPCAD.e",PERIOD_CURRENT,StartLength+shift)))
      )/2;
      
      }

 what is wrong with this

i have mq4 code working well but no success in mql5

can someone help plz

 
kakadoo:

hello

i am trying to combine rsi+demark to creat new oscillator

main caculation is like this :

 what is wrong with this

i have mq4 code working well but no success in mql5

can someone help plz

What is exactly your problem, what do you mean by "no success" ?
 
there is no output
 
kakadoo:
there is no output
Which output ? The code you post doesn't have any output. If you need and hope help, you have to be more explicit. With what you give us as information it is impossible to help you.
 
angevoyageur:
Which output ? The code you post doesn't have any output. If you need and hope help, you have to be more explicit. With what you give us as information it is impossible to help you.
//--- indicator settings
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_plots   1
#property indicator_type1   DRAW_LINE
#property indicator_color1  DodgerBlue
//--- input parameters
input int ind_period=12; // Period
//--- indicator buffers
double    ExtRSI_DEMBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
void OnInit()
  {
//--- indicator buffers mapping
   SetIndexBuffer(0,ExtRSI_DEMBuffer,INDICATOR_DATA);
   
//--- set accuracy
   IndicatorSetInteger(INDICATOR_DIGITS,_Digits+1);
//--- set first bar from what index will be drawn
   PlotIndexSetInteger(0,PLOT_DRAW_BEGIN,ind_period-1);
//--- name for DataWindow and indicator subwindow label
   IndicatorSetString(INDICATOR_SHORTNAME,"RSI+DEMARK("+string(ind_period)+")");
//--- initialization done
  }
//+------------------------------------------------------------------+
//| Detrended Price Oscillator                                       |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const int begin,
                const double &price[])
  {
   int limit;
   int firstInd=begin+ind_period-1;
//--- correct draw begin
   if(begin>0) PlotIndexSetInteger(0,PLOT_DRAW_BEGIN,firstInd);
//--- preliminary calculations
   if(prev_calculated<firstInd)
     {
      //--- filling  
      ArrayInitialize(ExtRSI_DEMBuffer,0.0);
      limit=firstInd;
     }
   else limit=prev_calculated-1;
//--- the main loop of calculations
   for(int i=limit;i<rates_total && !IsStopped();i++)
      ExtRSI_DEMBuffer[i]=
      (
      (iRSI("GBPUSD.e",PERIOD_CURRENT,ind_period,PRICE_CLOSE))+
      (100*(iDeMarker("GBPUSD.e",PERIOD_CURRENT,ind_period)))
      )/2;
//--- done
   return(rates_total);
  }
//+------------------------------------------------------------------+
 

i don't know what is the problem 

this is a basic step in my main trading system and i need to migrate to mt5

i had used another code and i tried to adapt it

 
kakadoo:

i don't know what is the problem 

this is a basic step in my main trading system and i need to migrate to mt5

i had used another code and i tried to adapt it

Look at the example here: https://www.mql5.com/en/docs/indicators/irsi   you have to use iRSI differently to how you use it in mql4,  there is no shift passed to the iRSI function.  You also need to look at IndicatorCreate()  and  MqlParam   . . .  I think,  I've never done this so I can't give any concrete advice.
Documentation on MQL5: Technical Indicators / iRSI
Documentation on MQL5: Technical Indicators / iRSI
  • www.mql5.com
Technical Indicators / iRSI - Documentation on MQL5
 
RaptorUK:
Look at the example here: https://www.mql5.com/en/docs/indicators/irsi   you have to use iRSI differently to how you use it in mql4,  there is no shift passed to the iRSI function.  You also need to look at IndicatorCreate()  and  MqlParam   . . .  I think,  I've never done this so I can't give any concrete advice.

thank you

 i will try it 

 

i think i should learn whole mql5 for this perpuse

i hate mql5 .

mql4 was so easy for learning and useage 

 
kakadoo:

i think i should learn whole mql5 for this perpuse

i hate mql5 .

mql4 was so easy for learning and useage 

MQL4 is more easy but MQL5 is more powerful. Anyway you always have to learn to code.
 
kakadoo:

i think i should learn whole mql5 for this perpuse

i hate mql5 .

mql4 was so easy for learning and useage 

I feel your pain . . . I really do.  I spent many hours chasing an issue only to discover that the MT5 Strategy Tester does not use a fixed spread as it does in MT4.  On my way to discovering this I also learned many other things during the journey so it wasn't wasted time.