visually backtest with custon indicator

hamid_gh11
9
hamid_gh11  

hi.

when I use icustom indicator in my EA , in Visually backtest, add a new indicator window in each cycle or each tick. what should I do?

for example when I use iRSI(Symbol(),Period(),14)  in back test, just draw one indicator RSI and every thing is OK . but when i change it to iCustom(Symbol(),Period(),"RSI",14) it add a new RSI window in each tick or each cycle! how can I solve this problem?

thanks.



double  iCustom_buf[];
void OnTick()
  {
   string name="Examples\\RSI";
   
   int handle_iCustom=iCustom(Symbol(),Period(),name,14);
  //int handle_iCustom=iRSI(Symbol(),Period(),14,PRICE_CLOSE);
 
   int err1=CopyBuffer(handle_iCustom,0,0,1,iCustom_buf);

   Comment(iCustom_buf[0]);
  }

Documentation on MQL5: Technical Indicators / iCustom
Documentation on MQL5: Technical Indicators / iCustom
  • www.mql5.com
[in]  Custom indicator name. If the name starts with the reverse slash '\', the EX5 indicator file is searched for relative to the MQL5\Indicators indicator root directory. Thus, when calling FirstIndicator"...), the indicator is downloaded as MQL5\Indicators\FirstIndicator.ex5. If the path contains no file, the error 4802...
Files:
222222.jpg 763 kb
Paul Anscombe
5130
Paul Anscombe  
hamid_gh11:

hi.

when I use icustom indicator in my EA , in Visually backtest, add a new indicator window in each cycle or each tick. what should I do?

for example when I use iRSI(Symbol(),Period(),14)  in back test, just draw one indicator RSI and every thing is OK . but when i change it to iCustom(Symbol(),Period(),"RSI",14) it add a new RSI window in each tick or each cycle! how can I solve this problem?

thanks.



double  iCustom_buf[];
void OnTick()
  {
   string name="Examples\\RSI";
   
   int handle_iCustom=iCustom(Symbol(),Period(),name,14);
  //int handle_iCustom=iRSI(Symbol(),Period(),14,PRICE_CLOSE);
 
   int err1=CopyBuffer(handle_iCustom,0,0,1,iCustom_buf);

   Comment(iCustom_buf[0]);
  }

You should only get the handle once in OnInit not every tick...

https://www.mql5.com/en/docs/indicators/icustom 

Documentation on MQL5: Technical Indicators / iCustom
Documentation on MQL5: Technical Indicators / iCustom
  • www.mql5.com
[in]  Custom indicator name. If the name starts with the reverse slash '\', the EX5 indicator file is searched for relative to the MQL5\Indicators indicator root directory. Thus, when calling FirstIndicator"...), the indicator is downloaded as MQL5\Indicators\FirstIndicator.ex5. If the path contains no file, the error 4802...
hamid_gh11
9
hamid_gh11  
Paul Anscombe:

You should only get the handle once in OnInit not every tick...

https://www.mql5.com/en/docs/indicators/icustom 

thank you very much for your help.