Price Data Components
Miscellaneous
0
Views
0
Downloads
0
Favorites
HMA_Cross
//+------------------------------------------------------------------+
//| HMA Cross.mq4 |
//| Revamped and Formatted For HMA By BLUR71 |
//| Original Code By Kalenzo, Modded By Newdigital |
//+------------------------------------------------------------------+
#property copyright "BLUR71"
#property link "blrobertsjr@hotmail.com"
#property link "www.forex-tsd.com"
#property indicator_chart_window
#property indicator_color1 Aqua
#property indicator_color2 Magenta
#property indicator_width1 3
#property indicator_width2 3
#property indicator_buffers 2
extern string HMAFile = "HMA Color NRP";
extern double HMAPeriod1 = 7,
HMAPrice1 = 6,
HMAType1 = 3,
HMAPeriod2 = 12,
HMAPrice2 = 6,
HMAType2 = 3,
SellFilter = 0,
BuyFilter = 0;
extern string AlertFile = "Alert.wav";
extern bool AlertCross = true,
AlertSound = false,
AlertInfo = false,
DataSelect = false;
//----
double UpBuffer[],
DnBuffer[],
alertBar;
//----
int init()
{SetIndexStyle(0,DRAW_ARROW,EMPTY);
SetIndexStyle(1,DRAW_ARROW,EMPTY);
SetIndexBuffer(0,UpBuffer);
SetIndexBuffer(1,DnBuffer);
SetIndexArrow(0,233);
SetIndexArrow(1,234);
SetIndexLabel(0,"Up");
SetIndexLabel(1,"Down");
if(DataSelect==false)
SetIndexLabel(0,NULL);
SetIndexLabel(1,NULL);
return(0);}
//----
int deinit()
{ return(0); }
//----
int start()
{int limit,
counted_bars=IndicatorCounted();
if(counted_bars<0) counted_bars=0;
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
for(int i = 0 ;i < limit ;i++)
{double PrevHMA1 = iCustom(NULL,0,HMAFile,HMAPeriod1,HMAPrice1,HMAType1,0,i+1),
CurrHMA1 = iCustom(NULL,0,HMAFile,HMAPeriod1,HMAPrice1,HMAType1,0,i),
PrevHMA2 = iCustom(NULL,0,HMAFile,HMAPeriod2,HMAPrice2,HMAType2,0,i+1),
CurrHMA2 = iCustom(NULL,0,HMAFile,HMAPeriod2,HMAPrice2,HMAType2,0,i);
//----
if( CurrHMA1 > (CurrHMA2 +(BuyFilter*Point)) && PrevHMA1 <= PrevHMA2)
{UpBuffer[i] = iLow(Symbol(),0,i)-(3*Point);
DnBuffer[i] = EMPTY_VALUE;
if (AlertSound==1) PlaySound(AlertFile);
if (AlertCross==1 && Bars>alertBar) {Alert(Symbol(),Period()," HMA "+DoubleToStr(HMAPeriod1,0)+" x "+
DoubleToStr(HMAPeriod2,0)+" Buy");alertBar = Bars;}
if (AlertInfo==1) Comment (" HMA X Buy @ Ask:",Ask,", Bid:",Bid,", ",TimeToStr(CurTime(),TIME_DATE)," ",
TimeHour(CurTime()),":",TimeMinute(CurTime()),", ",Symbol()," ",Period());}
else if( PrevHMA1 >= PrevHMA2 && CurrHMA1 < (CurrHMA2 - (SellFilter*Point)))
{UpBuffer[i] = EMPTY_VALUE;
DnBuffer[i] = iHigh(Symbol(),0,i)+(3*Point);
if (AlertSound==1) PlaySound(AlertFile);
if (AlertCross==1 && Bars>alertBar) {Alert(Symbol(),Period()," HMA "+DoubleToStr(HMAPeriod1,0)+" x "+
DoubleToStr(HMAPeriod2,0)+" Sell");alertBar = Bars;}
if (AlertInfo==1) Comment (" HMA X Sell @ Ask:",Ask,", Bid:",Bid,", ",TimeToStr(CurTime(),TIME_DATE)," ",
TimeHour(CurTime()),":",TimeMinute(CurTime()),", ",Symbol()," ",Period());}
else
{DnBuffer[i] = EMPTY_VALUE;
UpBuffer[i] = EMPTY_VALUE;}}
//----
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
---