Miscellaneous
0
Views
0
Downloads
0
Favorites
SpearmenRankCorrelation_NTF_variant3colors
//+------------------------------------------------------------------+
//| SpearmenRankCorrelation_NTF.mq4 |
//| * |
//| * |
//+------------------------------------------------------------------+
#property copyright "*"
#property link "*"
#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 Yellow
#property indicator_color2 Red
#property indicator_color3 Lime
#property indicator_level1 0.8
#property indicator_level2 -0.8
extern int NextTimeFrame=60;
extern int rangeN = 14;
extern int CalculatedBars = 0;
extern int Maxrange = 30;
extern bool direction = true;
//extern int SM1=5;
//extern int SM2=15;
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(2,DRAW_LINE);
SetIndexBuffer(2,ExtMapBuffer1);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1,ExtMapBuffer2);
//SetIndexStyle(2,DRAW_LINE);
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,ExtMapBuffer3);
//---óñòàíîâêà íóëåâûõ çíà÷åíèé
SetIndexEmptyValue(0,EMPTY_VALUE);
SetIndexEmptyValue(1,EMPTY_VALUE);
SetIndexEmptyValue(2,EMPTY_VALUE);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
datetime daytimes[];
static bool err;
//---
int p = Period();
int k = NextTimeFrame/p;
//---
ArrayCopySeries(daytimes,MODE_TIME,Symbol(),NextTimeFrame);
if(GetLastError()==4066){
err=true;
return(0);
}
int limit=Bars-IndicatorCounted();//êîëè÷åñòâî áàðîâ äëÿ êîòîðûõ íå ïðîâåäåí ðàñ÷åò èíäèêàòîðà
if(err){
err=false;
limit=Bars;
}
int NTFBarNum=iBarShift(NULL,NextTimeFrame,Time[limit-1],false);
datetime NTFTime=iTime(NULL,NextTimeFrame,NTFBarNum);
limit=iBarShift(NULL,0,NTFTime)+1;
for(int i=limit-1;i>=0;i--){
int BarNum=iBarShift(NULL,NextTimeFrame,Time[i],false);
//ExtMapBuffer1[i]=iCustom(NULL,NextTimeFrame,"SpearmanRankCorrS",rangeN,CalculatedBars,Maxrange,direction,SM1,SM2,0,BarNum);
//ExtMapBuffer3[i]=iCustom(NULL,NextTimeFrame,"SpearmanRankCorrS",rangeN,CalculatedBars,Maxrange,direction,SM1,SM2,0,BarNum);
//ExtMapBuffer3[i]=iCustom(NULL,NextTimeFrame,"SpearmanRankCorrS",rangeN,CalculatedBars,Maxrange,direction,SM1,SM2,2,BarNum);
ExtMapBuffer3[i]=iCustom(NULL,NextTimeFrame,"SpearmanRankCorr",rangeN,CalculatedBars,Maxrange,direction,0,BarNum);
if(ExtMapBuffer3[i+k]<=ExtMapBuffer3[i]){ExtMapBuffer1[i]=ExtMapBuffer3[i];ExtMapBuffer2[i]=EMPTY_VALUE;}
if(ExtMapBuffer3[i+k]>=ExtMapBuffer3[i]){ExtMapBuffer2[i]=ExtMapBuffer3[i];ExtMapBuffer1[i]=EMPTY_VALUE;}
//if(ExtMapBuffer3[i+k]==ExtMapBuffer3[i]){ExtMapBuffer2[i]=ExtMapBuffer2[i+k];ExtMapBuffer1[i]=ExtMapBuffer1[i+k];}
}
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
---