Miscellaneous
0
Views
0
Downloads
0
Favorites
Speedometer_v1
//+------------------------------------------------------------------+
//| Speedometer_v1.mq4 |
//| Copyright © 2006, Forex-TSD.com |
//| Written by IgorAD,igorad2003@yahoo.co.uk |
//| 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_buffers 2
#property indicator_color1 DodgerBlue
#property indicator_color2 Tomato
#property indicator_width1 3
#property indicator_width2 3
#property indicator_level1 0
extern int SpeedLimit=0;
double UpSpeed[];
double DnSpeed[];
//double price,prevprice,MaxUpSpeed=-1;
int init()
{
string short_name;
SetIndexStyle(0,DRAW_HISTOGRAM);
SetIndexBuffer(0,UpSpeed);
SetIndexStyle(1,DRAW_HISTOGRAM);
SetIndexBuffer(1,DnSpeed);
short_name="Speedometer";
IndicatorShortName(short_name);
SetIndexLabel(0,"Up");
SetIndexLabel(1,"Down");
return(0);
}
int start()
{
int i, counted_bars=IndicatorCounted(),limit;
if ( counted_bars > 0 ) limit=Bars-counted_bars;
if ( counted_bars < 0 ) return(0);
if ( counted_bars ==0 ) limit=Bars-1;
for(i=0;i<limit;i++)
{
double dTime = Period();
if (i==0) dTime = (TimeCurrent()-Time[i])/60.0;
if(dTime > 0)
double Speed = (Close[i]-Open[i])/dTime/Point;
if ( Speed >= 0) {UpSpeed[i]=Speed; DnSpeed[i] = 0;}
else if ( Speed<0) {DnSpeed[i] = Speed; UpSpeed[i] = 0;}
}
//----------
string Message;
if ( SpeedLimit>0 && UpSpeed[0] > SpeedLimit && Volume[0]>1/*&& !UpTrendAlert*/)
{
Message = " "+Symbol()+" M"+Period()+": Exceeding of Speed Limit - BUY";
Alert (Message);
//UpTrendAlert=true; DownTrendAlert=false;
}
if ( SpeedLimit>0 && DnSpeed[0] < -SpeedLimit && Volume[0]>1/*&& !DownTrendAlert*/)
{
Message = " "+Symbol()+" M"+Period()+": Exceeding of Speed Limit - SELL";
Alert (Message);
//DownTrendAlert=true; UpTrendAlert=false;
}
//----
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
---