//+------------------------------------------------------------------+
//| XAUUSD Signal Indicator |
//| Young B FX |
//+------------------------------------------------------------------+
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Lime
#property indicator_color2 Red
double BuyBuffer[];
double SellBuffer[];
input int FastEMA = 20;
input int SlowEMA = 50;
input int RSI_Period = 14;
int OnInit()
{
SetIndexBuffer(0, BuyBuffer);
SetIndexBuffer(1, SellBuffer);
PlotIndexSetInteger(0, PLOT_ARROW, 233);
PlotIndexSetInteger(1, PLOT_ARROW, 234);
return(INIT_SUCCEEDED);
}
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[])
{
for(int i = SlowEMA; i < rates_total-1; i++)
{
double fastEMA = iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i);
double slowEMA = iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i);
double rsi = iRSI(NULL,0,RSI_Period,PRICE_CLOSE,i);
BuyBuffer[i] = EMPTY_VALUE;
SellBuffer[i] = EMPTY_VALUE;
// BUY SIGNAL
if(fastEMA > slowEMA && rsi > 55 && close[i] > open[i])
{
BuyBuffer[i] = low[i] - 100 * _Point;
}
// SELL SIGNAL
if(fastEMA < slowEMA && rsi < 45 && close[i] < open[i])
{
SellBuffer[i] = high[i] + 100 * _Point;
}
}
return(rates_total);
}
//+------------------------------------------------------------------+
//| XAUUSD Signal Indicator |
//| Young B FX |
//+------------------------------------------------------------------+
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Lime
#property indicator_color2 Red
double BuyBuffer[];
double SellBuffer[];
input int FastEMA = 20;
input int SlowEMA = 50;
input int RSI_Period = 14;
int OnInit()
{
SetIndexBuffer(0, BuyBuffer);
SetIndexBuffer(1, SellBuffer);
PlotIndexSetInteger(0, PLOT_ARROW, 233);
PlotIndexSetInteger(1, PLOT_ARROW, 234);
return(INIT_SUCCEEDED);
}
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[])
{
for(int i = SlowEMA; i < rates_total-1; i++)
{
double fastEMA = iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i);
double slowEMA = iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i);
double rsi = iRSI(NULL,0,RSI_Period,PRICE_CLOSE,i);
}
return(rates_total);
}