Miscellaneous
0
Views
0
Downloads
0
Favorites
_TRO_Decimals
//+------------------------------------------------------------------+
//| _TRO_Open |
//| |
//| |
//+------------------------------------------------------------------+
#property indicator_separate_window
#property indicator_buffers 4
#property indicator_color1 Aqua
#property indicator_color2 White
#property indicator_color3 Magenta
#property indicator_color4 Aqua
// indicators parameters
extern bool ShowTotals = false;
extern int myMaxBars = 100;
extern double myThreshold = 0.05 ;
//---- buffers
double P1Buffer[];
double P2Buffer[];
double P3Buffer[];
double P4Buffer[];
double xPrice ;
int myStyle = 2 ;
int myWingDing = 250 ;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
SetIndexBuffer(0, P1Buffer);
SetIndexBuffer(1, P2Buffer);
SetIndexBuffer(2, P3Buffer);
SetIndexBuffer(3, P4Buffer);
SetIndexArrow(0, myWingDing);
SetIndexArrow(1, myWingDing);
SetIndexArrow(2, myWingDing);
SetIndexArrow(3, myWingDing);
SetIndexStyle(0, DRAW_LINE, myStyle, 1);
SetIndexStyle(1, DRAW_LINE, myStyle, 1);
SetIndexStyle(2, DRAW_ARROW, myStyle, 1);
SetIndexStyle(3, DRAW_LINE, myStyle, 1);
SetIndexEmptyValue(0,0);
SetIndexEmptyValue(1,0);
SetIndexEmptyValue(2,0);
SetIndexEmptyValue(3,0);
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int i, dayi, counted_bars = IndicatorCounted();
//---- check for possible errors
if(counted_bars < 0)
return(-1);
//---- last counted bar will be recounted
if(counted_bars > 0)
counted_bars--;
// int limit = Bars - counted_bars;
int limit = myMaxBars ;
//----
int xA = 0, xB = 0, xE = 0 ;
for(i = limit - 1; i >= 0; i--)
{
if ( Point == 0.01 ) {xPrice = MathMod(Close[i],1.00) ; P3Buffer[i] = xPrice * 100 ;}
else { xPrice = MathMod(100*Close[i],1.00)*0.01 ; P3Buffer[i] = xPrice * 10000 ;}
if ( xPrice > myThreshold && xPrice < (1 - myThreshold ) ) xA = xA + 1 ;
else xE = xE + 1 ;
P1Buffer[i] = myThreshold * 100;
P4Buffer[i] = 100 - myThreshold*100 ;
if (ShowTotals) { P2Buffer[i] = xE ; P3Buffer[i] = xA ; }
} // for
return(0);
} // start
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
---