teefery:
I tried to scale some indicators to 0-1 using the normalizer available to download on this site https://www.mql5.com/en/code/8572 , which is apparently a popular tool to achieve what I tried to do.
I tried to scale some indicators to 0-1 using the normalizer available to download on this site https://www.mql5.com/en/code/8572 , which is apparently a popular tool to achieve what I tried to do.
But I was only able to get it going for certain indicators like CCI and MACD, but not others default or my own custom indicators....
- Use the link button
- The normalizer scales to +/- one. If you want 0-1 you'll have to modify it.
- "Doesn't work" is meaningless - just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires - meaningless. There are no mind readers here.
Show your code and explain what it does and what you want.
WHRoeder:
- Use the link button
- The normalizer scales to +/- one. If you want 0-1 you'll have to modify it.
- "Doesn't work" is meaningless - just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires - meaningless. There are no mind readers here. Show your code and explain what it does and what you want.
Thanks for your advice, i'm sorry i'm new to this.
So heres my chart when I attach the normalizer with CCI, MACD, ATR and RSI, but was only able to get the normalized CCI and MACD working but not other two. I used default inputs and just changed the inidicators' names.
Is there's a particular step I missed out?
heres are the code for the normalizer
#property copyright "Copyright © 2008, al_su" #property link "al_su31@mail.ru" #property indicator_separate_window #property indicator_buffers 1 #property indicator_maximum 1 #property indicator_minimum -1 #property indicator_level1 0.25 #property indicator_level2 0.5 #property indicator_level3 0.75 #property indicator_level4 -0.25 #property indicator_level5 -0.5 #property indicator_level6 -0.75 #property indicator_color1 DodgerBlue //---- input parameters #define PERIODS_CHARACTERISTIC 2 extern string Indicator; extern int mode=1; extern int param1=8;//Íó èëè 9, íå âàæíî... extern int param2=9; //extern int param3;Ñêîêà íàäî ïàðàìåòðîâ, ñòîêà è çàäàåì //---- buffers double Normalizer[]; double characteristic_period; double sigma; //------------------------------------------------------------------------------- double Indyuk(int shift) { return (iCustom(0,0,Indicator,param1,param2,/*param3, è ò.ä.:)*/mode,shift)); } double MathTanh(double x) { double exp; if(x>0) {exp=MathExp(-2*x);return ((1-exp)/(1+exp));} else {exp=MathExp(2*x);return ((exp-1)/(1+exp));} } double ArrayAverage(double a[]) { int i; double s; if(ArraySize(a)<1) return (0); s=0; for(i=0;i<ArraySize(a);i++) s+=a[i]; return (s/ArraySize(a)); } //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators IndicatorShortName("Normalized "+Indicator); SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,Normalizer); int i; int count, count_zeros; count=0; count_zeros=0; double periods[]; for(i=Bars-2;i>=0;i--) { if(Indyuk(i)*Indyuk(i+1)<0)//ïåðåõîä ÷åðåç 0 { count++; ArrayResize(periods,count); periods[ArraySize(periods)-1]=0; } if(ArraySize(periods)>0) periods[ArraySize(periods)-1]++; } characteristic_period=2*PERIODS_CHARACTERISTIC*ArrayAverage(periods); SetIndexDrawBegin(0,characteristic_period); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int i,j, counted_bars=IndicatorCounted(); double S; //---- for(i=Bars-counted_bars-characteristic_period-1;i>=0;i--) { S=0; for(j=0;j<characteristic_period;j++) S+=MathPow(Indyuk(i+j),2); S/=characteristic_period; S=MathSqrt(S); if(S!=0) Normalizer[i]=Indyuk(i)/S; Normalizer[i]=MathTanh(Normalizer[i]); } //---- return(0); }
WHRoeder:
Zero is not a valid symbol. Use NULL or _Symbol or Symbol().
I tried that, and they give the same result...
Zero is not a valid symbol. Use NULL or _Symbol or Symbol().
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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!
Im rather new to coding in the MT4 platform and I have got a very noob question to ask...
I tried to scale some indicators to 0-1 using the normalizer available to download on this site https://www.mql5.com/en/code/8572 , which is apparently a popular tool to achieve what I tried to do.
But I was only able to get it going for certain indicators like CCI and MACD, but not others default or my own custom indicators....
any ideas?
Much Appreciated!