Price Data Components
Indicators Used
0
Views
0
Downloads
0
Favorites
Gold Spread of Williams
//+------------------------------------------------------------------+
//| GoldSpread.mq4 |
//| Copyright © 2009, C-4, All Rights Reserved. |
//| vs-box@mail.ru |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, C-4, All Rights Reserved."
#property link "vs-box@mail.ru"
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Red
extern string symbol_name="DX_CONT";//Íàçâàíèå èíñòðóìåíòà èíäåêñà äîëëàðà, âûñòàâëÿåòñÿ âðó÷íóþ.
double GoldSpread[],
SpreadDG[];
int init()
{
IndicatorBuffers(2);
SetIndexBuffer(0,GoldSpread);
SetIndexBuffer(1,SpreadDG);
IndicatorShortName("Gold Spread of Williams");
SetLevelValue(0,0.0);
SetLevelValue(1,0.3);
SetLevelValue(2,-0.3);
if(iTime(symbol_name,0,0)==0){
Print("Óêàçàíî íåñóùåñòâóþùåå íàçâàíèå èíñòðóìåíòà. Äàëüíåéøåå îòîáðàæåíèå èíäèêàòîðà áóäåò íåâîçìîæíî.");
Print("Ïðèñâîéòå ïåðåìåííîé symbol_name íàçâàíèå ñóùåñòâóþùåãî èíñòðóìåíòà(èíäåêñà äîëëàðà).");
}
return(0);
}
int start()
{
if(iBars(symbol_name,0)==0)return(1);
int limit,counted_bars;
counted_bars=IndicatorCounted();
limit=Bars-counted_bars;
for(int i=0; i<limit; i++){
SpreadDG[i]=iClose(symbol_name,0,i)-iClose(Symbol(),0,i);
}
for(i=0; i<limit; i++){
GoldSpread[i]=(iMAOnArray(SpreadDG,Bars,21,0,MODE_SMA,i)-iMAOnArray(SpreadDG,Bars,3,0,MODE_SMA,i))/100;
}
}
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
---