#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 clrLightPink
#property indicator_color2 clrAqua
#property indicator_width1 3
#property indicator_width2 3
input int RSIPeriod = 14;
input int ArrowDistance = 30;
double arrowUp[], arrowDown[];
double RSInow, RSIprevious, SMA;
int OnInit()
{
IndicatorBuffers(2);
SetIndexBuffer(0,arrowUp);
SetIndexBuffer(1,arrowDown);
SetIndexStyle(0,DRAW_ARROW);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(0,233);
SetIndexArrow(1,234);
SetIndexDrawBegin(0,RSIPeriod);
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[])
{
int limit = rates_total - prev_calculated - 1;
if(limit < 1) limit = 1;
for(int i = limit; i >= 0; i--)
{
RSInow = iRSI(NULL, 0, RSIPeriod, PRICE_CLOSE, i);
RSIprevious = iRSI(NULL, 0, RSIPeriod, PRICE_CLOSE, i + 1);
SMA = iMA(NULL,0, 200, 0, MODE_SMA, PRICE_CLOSE, i);
arrowUp[i] = EMPTY_VALUE;
arrowDown[i] = EMPTY_VALUE;
if(RSIprevious <= 30 && RSInow > 30 && close[i] < SMA)
{
arrowUp[i] = Low[i] - (ArrowDistance * Point());
}
else if(RSIprevious >= 70 && RSInow < 70 && close[i] > SMA)
{
arrowDown[i] = High[i] + (ArrowDistance * Point());
}
}
return(rates_total);
}
// Bars, IndicatorCounted(), return(0)
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
Mymacd_20210418mq4
#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 clrLightPink
#property indicator_color2 clrAqua
#property indicator_color3 clrOrange
#property indicator_color4 clrLime
#property indicator_width1 4
#property indicator_width2 4
#property indicator_width3 4
#property indicator_width4 4
input int TimeFrame=0;
input int FastEMA=12;
input int SlowEMA=26;
input int SignalSMA=9;
input int applied_price=0;
input int ArrowDistance = 30;
double arrowUp[];
double arrowDown[];
double arrowGC[];
double arrowDC[];
double FastEMAprevious;
double FastEMAnow;
double SlowEMAprevious;
double SlowEMAnow;
int OnInit()
{
IndicatorBuffers(4);
SetIndexBuffer(0, arrowUp);
SetIndexBuffer(1, arrowDown);
SetIndexBuffer(2, arrowGC);
SetIndexBuffer(3, arrowDC);
SetIndexStyle(0, DRAW_ARROW);
SetIndexStyle(1, DRAW_ARROW);
SetIndexStyle(2, DRAW_ARROW);
SetIndexStyle(3, DRAW_ARROW);
SetIndexArrow(0, 233);
SetIndexArrow(1, 234);
SetIndexArrow(2, 93);
SetIndexArrow(3, 93);
SetIndexDrawBegin(0,FastEMA);
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[])
{
int limit = rates_total - prev_calculated - 1;
if (limit < 1) limit = 1;
for (int i=limit; i>=0; i--)
{
FastEMAprevious = iMACD(NULL,TimeFrame,FastEMA,SlowEMA,SignalSMA,applied_price,0,i+1);
FastEMAnow = iMACD(NULL,TimeFrame,FastEMA,SlowEMA,SignalSMA,applied_price,0,i);
SlowEMAprevious = iMACD(NULL,TimeFrame,FastEMA,SlowEMA,SignalSMA,applied_price,1,i+1);
SlowEMAnow = iMACD(NULL,TimeFrame,FastEMA,SlowEMA,SignalSMA,applied_price,1,i);
arrowUp[i] = EMPTY_VALUE;
arrowDown[i] = EMPTY_VALUE;
arrowGC[i] = EMPTY_VALUE;
arrowDC[i] = EMPTY_VALUE;
if((FastEMAnow >= 0)&&(FastEMAprevious <= SlowEMAprevious)&&(FastEMAnow > SlowEMAnow))
arrowUp[i] = low[i] - (ArrowDistance*Point());
else if((FastEMAnow <= 0)&&(FastEMAprevious >= SlowEMAprevious)&&(FastEMAnow < SlowEMAnow))
arrowDown[i] = high[i] + (ArrowDistance*Point());
if((FastEMAprevious <= 0)&&(FastEMAnow > 0))
arrowGC[i] = low[i] - (ArrowDistance*Point()*13);
else if((FastEMAprevious >= 0)&&(FastEMAnow < 0))
arrowDC[i] = high[i] + (ArrowDistance*Point()*13);
}
return(rates_total);
}
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
//| 202104241624iCustomMA.mq4 |
//| Copyright 2019, MetaQuotes Software Corp. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2019, MetaQuotes Software Corp."
#property link "https://www.mql5.com"
#property version "1.00"
#property strict
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 clrLightPink
#property indicator_color2 clrAqua
#property indicator_width1 2
#property indicator_width2 2
input int MAPeriodFast = 13;
input int MAPeriodSlow = 25;
double BufferFast[];
double BufferSlow[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//--- indicator buffers mapping
SetIndexBuffer(0, BufferFast);
SetIndexBuffer(1, BufferSlow);
SetIndexLabel(0, "FastSMA("+MAPeriodFast+")");
SetIndexLabel(1, "SlowSMA("+MAPeriodSlow+")");
//---
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;
for(int i=limit-1; i>=0; i--)
{
BufferFast[i] = iCustom(NULL, 0, "Custom Moving Averages", MAPeriodFast, 0, i);
BufferSlow[i] = iCustom(NULL, 0, "Custom Moving Averages", MAPeriodSlow, 0, i);
}
//--- return value of prev_calculated for next call
return(rates_total);
}
// double val = iCustom (NULL, 0, "Custom Moving Averages",
13, 0, MODE_SMA, PRICE_CLOSE, 0, 1);
//+------------------------------------------------------------------+
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
Kudos to : MT4 ヒストリカルデータのダウンロード先とインポート手順 - 海外FX Wiki (runways.co.jp)
1. Max bars in history/chart 99999999999
2. uncheck Enable news
3. Enable proxy server -> Proxy... -> hogehoge -> OK
4. History Center Download 1Minute
5. Open Data Folder, History, Alpari-Trade02, delete .hst
6. Open Offline, Open 1 Minute chart
7. Drag & drop Period_ConverterAll.mq4 (Script)

