Indicators Used
Miscellaneous
0
Views
0
Downloads
0
Favorites
OsUSD
//+------------------------------------------------------------------+
//| OsUSD.mq4 |
//| Raymond Toh |
//| http://forex.eazel.com |
//+------------------------------------------------------------------+
#property copyright "Raymond Toh"
#property link "http://forex.eazel.com"
#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 Red
#property indicator_color2 Blue
double Signal_Up[];
double Signal_Down[];
double USD_Index[];
extern int MA_Period=12;
extern int MA_Shift=5;
extern int Price=6; //Weighted close price, (high+low+close+close)/4.
extern int Mode=3; //Linear weighted moving average.
int init()
{
IndicatorShortName("OsUSD("+MA_Period+","+MA_Shift+","+Price+","+Mode+")");
SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,2);
SetIndexBuffer(0,Signal_Up);
SetIndexLabel(0, "Signal_Up");
SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID,2);
SetIndexBuffer(1,Signal_Down);
SetIndexLabel(1, "Signal_Down");
SetIndexBuffer(2,USD_Index);
SetIndexLabel(2, "USD");
return(0);
}
int deinit()
{
return(0);
}
int start()
{
int limit;
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars-=1;
limit=Bars-counted_bars;
for(int i=0; i<limit; i++)
{
USD_Index[i]=
(iMA("EURUSD",0,MA_Period,0,Mode,Price,i+MA_Shift)-
iMA("EURUSD",0,MA_Period,0,Mode,Price,i))*10000
+
(iMA("GBPUSD",0,MA_Period,0,Mode,Price,i+MA_Shift)-
iMA("GBPUSD",0,MA_Period,0,Mode,Price,i))*10000
+
(iMA("USDCHF",0,MA_Period,0,Mode,Price,i)-
iMA("USDCHF",0,MA_Period,0,Mode,Price,i+MA_Shift))*10000
+
(iMA("USDJPY",0,MA_Period,0,Mode,Price,i)-
iMA("USDJPY",0,MA_Period,0,Mode,Price,i+MA_Shift))*100
;
if (USD_Index[i]>= 0){ Signal_Up[i] = USD_Index[i]; Signal_Down[i] = 0; }
else { Signal_Down[i] = USD_Index[i]; Signal_Up[i] = 0; }
}
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
---