Miscellaneous
0
Views
0
Downloads
0
Favorites
#Parabolic 2TF
//+------------------------------------------------------------------+
//| #Parabolic 2TF.mq4 |
//| cja |
//+------------------------------------------------------------------+
#property copyright "Kalenzo - code adapted to bars by cja"
#property link "http://www.foreksik.prv.pl"
#property indicator_separate_window
#property indicator_minimum 0
#property indicator_maximum 3
#property indicator_buffers 4
#property indicator_color1 DodgerBlue
#property indicator_color2 DodgerBlue
#property indicator_color3 OrangeRed
#property indicator_color4 OrangeRed
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
extern int Maxbars = 1500;
extern double Step = 0.02;
extern double Maximum = 0.20;
extern int Precision = 5;
extern int TF1 = PERIOD_M5;
extern int TF2 = PERIOD_M15;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0,110);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexEmptyValue(0,0.0);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1,110);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexEmptyValue(1,0.0);
SetIndexStyle(2,DRAW_ARROW);
SetIndexArrow(2,110);
SetIndexBuffer(2,ExtMapBuffer3);
SetIndexEmptyValue(2,0.0);
SetIndexStyle(3,DRAW_ARROW);
SetIndexArrow(3,110);
SetIndexBuffer(3,ExtMapBuffer4);
SetIndexEmptyValue(3,0.0);
IndicatorShortName("Para 2TF ( M"+TF1+" )( M"+TF2+" )");
RefreshRates();
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
ObjectDelete("Para_Label_m1");ObjectDelete("Para_Label_m5");
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
//----
int limit;
int TF[] = {0,0};
TF[0] = TF2;
TF[1] = TF1;
limit = MathMin(counted_bars,Maxbars);
if (limit ==0)
limit = Maxbars;
for (int ii=0; ii<limit; ii++)
{
ExtMapBuffer1[ii] = 0;
ExtMapBuffer2[ii] = 0;
ExtMapBuffer3[ii] = 0;
ExtMapBuffer4[ii] = 0;
for (int jj=0; jj<2; jj++)
{
int y = iBarShift(NULL, TF[jj], Time[ii]);
SetIndicator(GetCustomBars(TF[jj], y), jj, ii);
}
}
//----
return(0);
}
//+------------------------------------------------------------------+
bool GetCustomBars(int TF, int shift)
{
double h = iCustom(NULL,TF,"SAR Colour",Step,Maximum,Precision,0,shift);
double l = iCustom(NULL,TF,"SAR Colour",Step,Maximum,Precision,1,shift);
return(h<l);
}
void SetIndicator(bool isUP, int ind, int shift)
{
if (isUP)
{
switch (ind)
{
case 1: ExtMapBuffer1[shift] = ind+1; break;
case 0: ExtMapBuffer2[shift] = ind+1; break;
}
} else {
switch (ind)
{
case 1: ExtMapBuffer3[shift] = ind+1; break;
case 0: ExtMapBuffer4[shift] = ind+1; break;
}
color para_col15,para_col5;
if(ExtMapBuffer1[0]>ExtMapBuffer3[0]){para_col5=indicator_color1;}
if(ExtMapBuffer3[0]>ExtMapBuffer1[0]){para_col5=indicator_color3;}
if(ExtMapBuffer2[0]>ExtMapBuffer4[0]){para_col15=indicator_color2;}
if(ExtMapBuffer4[0]>ExtMapBuffer2[0]){para_col15=indicator_color4;}
ObjectDelete("Para_Label_m15");
if(ObjectFind("Para_Label_m15") != 0) {
ObjectCreate("Para_Label_m15", OBJ_TEXT,WindowFind("Para 2TF ( M"+TF1+" )( M"+TF2+" )"), Time[0],indicator_maximum-0.50);
ObjectSetText("Para_Label_m15", " M"+TF1+"",7, "Tahoma Bold",para_col5);
} else{ ObjectMove("Para_Label_m15", 0, Time[0],indicator_maximum-0.50); }
ObjectDelete("Para_Label_m5");
if(ObjectFind("Para_Label_m5") != 0) {
ObjectCreate("Para_Label_m5", OBJ_TEXT,WindowFind("Para 2TF ( M"+TF1+" )( M"+TF2+" )"), Time[0],indicator_maximum-1.50);
ObjectSetText("Para_Label_m5", " M"+TF2+"",7, "Tahoma Bold",para_col15);
} else{ ObjectMove("Para_Label_m5", 0, Time[0],indicator_maximum-1.50); }
}
}
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
---