Crash RVI SMA Scalper

Crash RVI SMA Scalper最新版

官方版无广告430

更新日期:2022-03-06分类标签:语言:中文平台:没限制

51 人已下载 手机查看

Crash RVI SMA Scalper

//+——————————————————————+
//| Indicator: Crash RVI SMA Scalper.mq5 |
//| Created with EABuilder.com |
//| https://www.eabuilder.com |
//+——————————————————————+
#property copyright “Created with EABuilder.com”
#property link “https://www.eabuilder.com”
#property version “1.00”
#property description “”

//— indicator settings
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_plots 2

#property indicator_type1 DRAW_ARROW
#property indicator_width1 3
#property indicator_color1 0xFFAA00
#property indicator_label1 “Buy”

#property indicator_type2 DRAW_ARROW
#property indicator_width2 3
#property indicator_color2 0x384BD9
#property indicator_label2 “Crash TP”

//— indicator buffers
double Buffer1[];
double Buffer2[];

datetime time_alert; //used when sending alert
input bool Send_Email = true;
input bool Audible_Alerts = true;
input bool Push_Notifications = true;
double myPoint; //initialized in OnInit
int MA_handle;
double MA[];
int MA_handle2;
double MA2[];
int RVI_handle;
double RVI_Main[];
double RVI_Signal[];
double Low[];
int ATR_handle;
double ATR[];
double High[];

void myAlert(string type, string message)
{
if(type == “print”)
Print(message);
else if(type == “error”)
{
Print(type+” | Crash RVI SMA Scalper @ “+Symbol()+”,”+IntegerToString(Period())+” | “+message);
}
else if(type == “order”)
{
}
else if(type == “modify”)
{
}
else if(type == “indicator”)
{
Print(type+” | Crash RVI SMA Scalper @ “+Symbol()+”,”+IntegerToString(Period())+” | “+message);
if(Audible_Alerts) Alert(type+” | Crash RVI SMA Scalper @ “+Symbol()+”,”+IntegerToString(Period())+” | “+message);
if(Send_Email) SendMail(“Crash RVI SMA Scalper”, type+” | Crash RVI SMA Scalper @ “+Symbol()+”,”+IntegerToString(Period())+” | “+message);
if(Push_Notifications) SendNotification(type+” | Crash RVI SMA Scalper @ “+Symbol()+”,”+IntegerToString(Period())+” | “+message);
}
}

//+——————————————————————+
//| Custom indicator initialization function |
//+——————————————————————+
int OnInit()
{
SetIndexBuffer(0, Buffer1);
PlotIndexSetDouble(0, PLOT_EMPTY_VALUE, EMPTY_VALUE);
PlotIndexSetInteger(0, PLOT_ARROW, 241);
SetIndexBuffer(1, Buffer2);
PlotIndexSetDouble(1, PLOT_EMPTY_VALUE, EMPTY_VALUE);
PlotIndexSetInteger(1, PLOT_ARROW, 242);
//initialize myPoint
myPoint = Point();
if(Digits() == 5 || Digits() == 3)
{
myPoint *= 10;
}
MA_handle = iMA(NULL, PERIOD_CURRENT, 9, 0, MODE_SMA, PRICE_CLOSE);
if(MA_handle < 0)
{
Print(“The creation of iMA has failed: MA_handle=”, INVALID_HANDLE);
Print(“Runtime error = “, GetLastError());
return(INIT_FAILED);
}

MA_handle2 = iMA(NULL, PERIOD_CURRENT, 16, 0, MODE_SMA, PRICE_CLOSE);
if(MA_handle2 < 0)
{
Print(“The creation of iMA has failed: MA_handle2=”, INVALID_HANDLE);
Print(“Runtime error = “, GetLastError());
return(INIT_FAILED);
}

RVI_handle = iRVI(NULL, PERIOD_CURRENT, 10);
if(RVI_handle < 0)
{
Print(“The creation of iRVI has failed: RVI_handle=”, INVALID_HANDLE);
Print(“Runtime error = “, GetLastError());
return(INIT_FAILED);
}

ATR_handle = iATR(NULL, PERIOD_CURRENT, 14);
if(ATR_handle < 0)
{
Print(“The creation of iATR has failed: ATR_handle=”, INVALID_HANDLE);
Print(“Runtime error = “, GetLastError());
return(INIT_FAILED);
}

return(INIT_SUCCEEDED);
}

//+——————————————————————+
//| Custom indicator iteration function |
//+——————————————————————+
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[])
{
int limit = rates_total – prev_calculated;
//— counting from 0 to rates_total
ArraySetAsSeries(Buffer1, true);
ArraySetAsSeries(Buffer2, true);
//— initial zero
if(prev_calculated < 1)
{
ArrayInitialize(Buffer1, EMPTY_VALUE);
ArrayInitialize(Buffer2, EMPTY_VALUE);
}
else
limit++;
datetime Time[];

if(BarsCalculated(MA_handle) <= 0)
return(0);
if(CopyBuffer(MA_handle, 0, 0, rates_total, MA) <= 0) return(rates_total);
ArraySetAsSeries(MA, true);
if(BarsCalculated(MA_handle2) <= 0)
return(0);
if(CopyBuffer(MA_handle2, 0, 0, rates_total, MA2) <= 0) return(rates_total);
ArraySetAsSeries(MA2, true);
if(BarsCalculated(RVI_handle) <= 0)
return(0);
if(CopyBuffer(RVI_handle, MAIN_LINE, 0, rates_total, RVI_Main) <= 0) return(rates_total);
ArraySetAsSeries(RVI_Main, true);
if(BarsCalculated(RVI_handle) <= 0)
return(0);
if(CopyBuffer(RVI_handle, SIGNAL_LINE, 0, rates_total, RVI_Signal) <= 0) return(rates_total);
ArraySetAsSeries(RVI_Signal, true);
if(CopyLow(Symbol(), PERIOD_CURRENT, 0, rates_total, Low) <= 0) return(rates_total);
ArraySetAsSeries(Low, true);
if(BarsCalculated(ATR_handle) <= 0)
return(0);
if(CopyBuffer(ATR_handle, 0, 0, rates_total, ATR) <= 0) return(rates_total);
ArraySetAsSeries(ATR, true);
if(CopyHigh(Symbol(), PERIOD_CURRENT, 0, rates_total, High) <= 0) return(rates_total);
ArraySetAsSeries(High, true);
if(CopyTime(Symbol(), Period(), 0, rates_total, Time) <= 0) return(rates_total);
ArraySetAsSeries(Time, true);
//— main loop
for(int i = limit-1; i >= 0; i–)
{
if (i >= MathMin(150000-1, rates_total-1-50)) continue; //omit some old rates to prevent “Array out of range” or slow calculation

//Indicator Buffer 1
if(MA[i] > MA2[i]
&& MA[i+1] < MA2[i+1] //Moving Average crosses above Moving Average
&& RVI_Main[i] > RVI_Signal[i] //Relative Vigor Index > Relative Vigor Index
)
{
Buffer1[i] = Low[i] – ATR[i]; //Set indicator value at Candlestick Low – Average True Range
if(i == 1 && Time[1] != time_alert) myAlert(“indicator”, “Buy”); //Alert on next bar open
time_alert = Time[1];
}
else
{
Buffer1[i] = EMPTY_VALUE;
}
//Indicator Buffer 2
if(RVI_Main[i] == 1 //Relative Vigor Index is equal to fixed value
)
{
Buffer2[i] = High[i] + ATR[i]; //Set indicator value at Candlestick High + Average True Range
if(i == 1 && Time[1] != time_alert) myAlert(“indicator”, “Crash TP”); //Alert on next bar open
time_alert = Time[1];
}
else
{
Buffer2[i] = EMPTY_VALUE;
}
}
return(rates_total);
}
//+——————————————————————+

如果你对文件有了解,请帮助投票!

If you are familiar with the file, please help vote!

平均评分 0 / 5. 投票数: 0

到目前为止还没有投票!成为第一位投票人。

相关资源

暂无评论

暂无评论...
Ads Blocker Image Powered by Code Help Pro

检测到广告拦截程序!!!Ads Blocker Detected!!!

我们检测到您正在使用扩展来屏蔽广告。请通过禁用这些广告屏蔽程序或者把网站加入白名单来支持我们。

We have detected that you are using an extension to block advertisements. Please support us by disabling these advertising blocking programs or adding the website to the whitelist.