-
【MT4】MQLプログラミング超初心者入門
投稿日 2020年8月29日 17:30:00 (自動売買)
【動画】MT4のMQLプログラミング超初心者入門
初心者でもできるMT4のMQLプログラミング
今回は、超初心者向け、ド素人でもわかるMT4によるプログラミングをやってみたいと思います。内容は、MQLを使ってチャートの高値を線で結んでみる、というものです。だから、移動平均線ですらないというレベルです。
でも、この線を1本引くだけの作業で、変数や配列、for文、if文を使うので、内容はかなり濃いと思います。
配列の数字
変数limitの中身
アルゴリズム
高値ラインを引くソースコード
//+------------------------------------------------------------------+
//| test.mq4 |
//| Copyright 2020, MetaQuotes Software Corp. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2020, MetaQuotes Software Corp."
#property link "https://www.mql5.com"
#property version "1.00"
#property strict
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_plots 1
//--- plot Label1
#property indicator_label1 "Label1"
#property indicator_type1 DRAW_LINE
#property indicator_color1 clrYellow
#property indicator_style1 STYLE_SOLID
#property indicator_width1 3
//--- indicator buffers
double Label1Buffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//--- indicator buffers mapping
SetIndexBuffer(0,Label1Buffer);
//---
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 i;
int limit;
if(prev_calculated==0){
limit=rates_total-1;
}
else
{
limit=rates_total-prev_calculated;
}
for(i=limit; i>=0; i--)
{
Label1Buffer[i]=high[i];
}
//--- return value of prev_calculated for next call
return(rates_total);
}
//+------------------------------------------------------------------+
Source: 【FXブログ】よく当たるFX為替レート予想
最新情報
投稿日 2025年3月26日 10:45:17 (自動売買)
投稿日 2025年3月25日 13:02:28 (自動売買)
投稿日 2025年3月24日 18:31:58 (自動売買)
投稿日 2025年3月24日 12:50:41 (自動売買)
投稿日 2025年3月24日 12:17:46 (自動売買)
投稿日 2025年3月24日 12:13:02 (自動売買)
投稿日 2025年3月24日 12:05:23 (自動売買)
投稿日 2025年3月24日 11:06:10 (自動売買)
投稿日 2025年3月23日 19:53:05 (自動売買)
投稿日 2025年3月23日 17:08:48 (自動売買)
投稿日 2025年3月23日 14:02:23 (自動売買)
投稿日 2025年3月23日 05:20:05 (自動売買)
投稿日 2025年3月22日 18:29:47 (自動売買)
投稿日 2025年3月22日 08:16:03 (自動売買)
投稿日 2025年3月21日 20:16:24 (自動売買)
投稿日 2025年3月20日 18:12:54 (自動売買)
投稿日 2025年3月20日 10:57:37 (自動売買)
投稿日 2025年3月17日 18:06:59 (自動売買)
投稿日 2025年3月17日 15:40:44 (自動売買)
投稿日 2025年3月16日 19:39:29 (自動売買)
投稿日 2025年3月16日 18:31:24 (自動売買)
投稿日 2025年3月15日 19:12:59 (自動売買)
投稿日 2025年3月15日 18:07:52 (自動売買)
投稿日 2025年3月15日 18:05:23 (自動売買)
投稿日 2025年3月15日 18:03:35 (自動売買)
投稿日 2025年3月15日 17:54:47 (自動売買)
投稿日 2025年3月14日 20:35:07 (自動売買)
投稿日 2025年3月14日 14:22:59 (自動売買)
投稿日 2025年3月11日 15:40:21 (自動売買)
投稿日 2025年3月11日 09:57:03 (自動売買)