Indicators Used
Miscellaneous
0
Views
0
Downloads
0
Favorites
Fisher Transform_v1
//+------------------------------------------------------------------+
//| Fisher_org_v1.1.mq4 |
//| Copyright © 2006, Forex-TSD.com |
//| Written by IgorAD |
//| http://finance.groups.yahoo.com/group/TrendLaboratory |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, Forex-TSD.com "
#property link "http://www.forex-tsd.com/"
#property indicator_separate_window
#property indicator_maximum 3.0
#property indicator_minimum -3.0
#property indicator_buffers 6
#property indicator_color1 LightBlue
#property indicator_color2 Tomato
#property indicator_color3 Gray
#property indicator_color4 Gray
#property indicator_color5 Gray
#property indicator_color6 Gray
//---- input parameters
extern int Length=10; // Period of Fisher Transform
extern int Price=4; // 0-Close;1-Open;2-High;3-Low;4-median;5-typical;6-weighted
extern int CalcBars=100; // Number of Last Bars
extern int NumBars=0; // Number of Bars on the Chart
extern int Offset=70; // Offset for lines
//---- buffers
double Fisher[];
double Buffer[];
double UpLine1[];
double DnLine1[];
double UpLine2[];
double DnLine2[];
double Value [];
int init()
{
IndicatorBuffers(7);
SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,1);
SetIndexStyle(1,DRAW_LINE,STYLE_DOT,1);
SetIndexStyle(2,DRAW_LINE,STYLE_DOT,0);
SetIndexStyle(3,DRAW_LINE,STYLE_DOT,0);
SetIndexStyle(4,DRAW_LINE,STYLE_DOT,0);
SetIndexStyle(5,DRAW_LINE,STYLE_DOT,0);
SetIndexBuffer(0,Fisher);
SetIndexBuffer(1,Buffer);
SetIndexBuffer(2,UpLine1);
SetIndexBuffer(3,DnLine1);
SetIndexBuffer(4,UpLine2);
SetIndexBuffer(5,DnLine2);
SetIndexBuffer(6,Value);
IndicatorShortName ("Fisher Transform");
SetIndexLabel (0, "Fish");
SetIndexLabel (1, "Trigger");
SetIndexDrawBegin(0,Length);
SetIndexDrawBegin(1,Length);
SetIndexDrawBegin(2,Length);
SetIndexDrawBegin(3,Length);
SetIndexDrawBegin(4,Length);
SetIndexDrawBegin(5,Length);
SetIndexShift( 2, Offset);
SetIndexShift( 3, Offset);
SetIndexShift( 4, Offset);
SetIndexShift( 5, Offset);
return(0);
}
//+------------------------------------------------------------------+
//| Fisher_org_v1.1 |
//+------------------------------------------------------------------+
int start()
{
int shift;
double smin=0,smax=0,maxfish=-1000000,minfish=1000000;
if (NumBars>0) int NBars=NumBars; else NBars=Bars;
if (CalcBars>0) int CBars=CalcBars; else CBars=NBars;
for(shift=NBars;shift>=0;shift--)
{
Buffer[shift]=0.0;
Value [shift]=0.0;
Fisher[shift]=0.0;
}
for(shift=NBars-2-Length;shift>=0;shift--)
{
smax = High[Highest(NULL,0,MODE_HIGH,Length,shift)];
smin = Low[Lowest(NULL,0,MODE_LOW,Length,shift)];
double price = iMA(NULL,0,1,0,0,Price,shift);
if (smax-smin < Point) smax=smin+Point;
double wpr=(price-smin)/(smax-smin);
Value[shift] = 0.33*2*(wpr-0.5) + 0.67*Value[shift+1];
if (Value[shift]> 0.99) Value[shift]= 0.999;
if (Value[shift]<-0.99) Value[shift]=-0.999;
Fisher[shift] = 0.5*MathLog((1.0+Value[shift])/(1.0-Value[shift]))+0.5*Fisher[shift+1];
Buffer[shift] = Fisher [shift+1];
if (shift<=CBars-1)
{
maxfish=MathMax(maxfish,Fisher[shift]);
minfish=MathMin(minfish,Fisher[shift]);
}
}
Comment ( " MaxFish= ",maxfish, " MinFish= ",minfish);
double fishlevel = NormalizeDouble(MathMax(maxfish,MathAbs(minfish)),2);
for(shift=NBars-2-Length;shift>=0;shift--)
{
UpLine1[shift]=fishlevel;
UpLine2[shift]=0.5*fishlevel;
DnLine1[shift]=-fishlevel;
DnLine2[shift]=-0.5*fishlevel;
}
return(0);
}
//+------------------------------------------------------------------+
Comments
Markdown Formatting Guide
# H1
## H2
### H3
**bold text**
*italicized text*
[title](https://www.example.com)

`code`
```
code block
```
> blockquote
- Item 1
- Item 2
1. First item
2. Second item
---