RichyF1:
it doesnt seem to work.
What that means exactly ?
it doesnt seem to work.
It's working fine for me.
int OnInit() { IndicatorSetString(INDICATOR_SHORTNAME,StringFormat("Bands on CCI(%d,%.1f)",BandsPeriod,Deviation)); IndicatorSetInteger(INDICATOR_DIGITS,0); //--- indicator handles handleCCI=iCustom(NULL,0,"CCI_OHLC"); handleBands=iBands(NULL,0,BandsPeriod,0,Deviation,handleCCI); //--- indicator buffers mapping SetIndexBuffer(0,OpenBuffer); SetIndexBuffer(1,HighBuffer); SetIndexBuffer(2,LowBuffer); SetIndexBuffer(3,CloseBuffer); SetIndexBuffer(4,ColorBuffer,INDICATOR_COLOR_INDEX); //--- SetIndexBuffer(5,BaseBuffer); SetIndexBuffer(6,UpperBuffer); SetIndexBuffer(7,LowerBuffer); //--- return(INIT_SUCCEEDED); }
pipPod:
It's working fine for me.
Hi pipPod and Alain
Thank you very very much, your suggestion worked very well for me. Really appreciate your help, hope I can return the favor sometime :)
For reference, if others are having this problem. I nested the custom indicator into another to get it to work, and it seems to work very well.
int OnInit() //--- indicator handles handlePairX=iCustom(Symbol(),0,"PairsX2",Symbol2,MA,StandardDev1,0.005); handleRSI1=iRSI(NULL,0,RSI1,handlePairX); handleRSI2=iRSI(NULL,0,RSI2,handlePairX); //and then in OnCalculate if(prev_calculated-1<rates_total) { for(int i=0;i<rates_total-1;i++) CopyBuffer(handleRSI1,0,i,1,tempbuff3); CopyBuffer(handleRSI2,0,i,1,tempbuff4); ind1[i]=tempbuff3[0]; //RSI1 ind2[i]=tempbuff4[0]; //RSI2
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi all
Recently I have been creating my own indicators and trying to look at markets in different ways, Pairs trading, or adding them together, basket trading.
In doing this I have been creating my own indicators to monitor the movements etc. I would like to place standard indicators on these, hence an indicator on an indicator.
This can be completed fine in MT5 UI, however doing this in code doesn't seem to work...... (ARGGHHHH).
An example, I am trying to export the data for the last 10000 bars of m5 data of my indicators and have created a script that loads my custom indicator. That works fine, but I would like to run iBands on this also. I have done this by passing the handle through of the custom indicator, however it doesnt seem to work.
Does anyone know the best way to run an indicator on another indicator, in code?
Sorry if this seems dumb, still trying to get my head around it. (Would also like to run a stochastic on it!!!)
Thanks in advance.
Rich