Miscellaneous
0
Views
0
Downloads
0
Favorites
RPoint-m_v2
//+------------------------------------------------------------------+
//| RPoint v2.mq4 |
//| Copyright © 2004-2008, Poul_Trade_Forum |
//| Aborigen & Kharko |
//| http://forex.kbpauk.ru/ |
//+------------------------------------------------------------------+
#property copyright "Aborigen & Kharko"
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Red
//---- input parameters
extern int ReversPoint=20;
extern bool Sound=true;
//---- buffers
double RBuffer[];
int Trend=1,InTrend,ttime;
double Points,Last_High, Last_Low=100000;
datetime LastTimeHigh=0,LastTimeLow=0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
string short_name;
if(Digits==5 || Digits==3)
ReversPoint*=10;
Points=MarketInfo (Symbol(), MODE_POINT);
//---- indicator line
SetIndexStyle(0,DRAW_SECTION,EMPTY,1,Tan);
SetIndexBuffer(0,RBuffer);
SetIndexEmptyValue(0,0);
//---- name for DataWindow and indicator subwindow label
short_name="RPoint v2";
IndicatorShortName(short_name);
SetIndexLabel(0,short_name);
//----
SetIndexDrawBegin(0,100);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//---- TODO: add your code here
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted(),i,shift,index;
static int count=0;
//---- TODO: add your code here
if(counted_bars>0) counted_bars--;
i=Bars-counted_bars;
//----
for(shift=i; shift>=0;shift--)
{
if (Trend==1)
{
if (High[shift]>Last_High)
{
if(LastTimeHigh!=0)
{
index=iBarShift(NULL,0,LastTimeHigh);
RBuffer[index]=0;
}
Last_High=High[shift];
RBuffer[shift]=Last_High;
LastTimeHigh=Time[shift];
}
if (Low[shift]<Last_High-ReversPoint*Points && LastTimeHigh<Time[shift])
{
Trend=0;
LastTimeHigh=0;
Last_High=0;
LastTimeLow=Time[shift];
RBuffer[shift]=Low[shift];
if(Sound && shift==0 && Last_Low==0)
PlaySound("alert2.wav");
Last_Low=RBuffer[shift];
}
}
if (Trend==0)
{
if (Low[shift]<Last_Low)
{
if(LastTimeLow!=0)
{
index=iBarShift(NULL,0,LastTimeLow);
RBuffer[index]=0;
}
Last_Low=Low[shift];
RBuffer[shift]=Last_Low;
LastTimeLow=Time[shift];
}
if (High[shift]>Last_Low+ReversPoint*Points && LastTimeLow<Time[shift])
{
Trend=1;
LastTimeLow=0;
Last_Low=100000;
LastTimeHigh=Time[shift];
RBuffer[shift]=High[shift];
if(Sound && shift==0 && Last_High==0)
PlaySound("alert2.wav");
Last_High=RBuffer[shift];
}
}
//----
}
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
---