日別アーカイブ: 2015年2月26日

平均からの乖離

平均(移動平均線)からの乖離をトレードシグナルにしていらっしゃる人が結構います。

ということで、乖離率を表示するインディケーターを自作してみました。

ついでに、乖離率の移動平均であるシグナルも表示します。

乖離率の計算に使用する移動平均線の種類も4種類から選べるようにしました。

サブウィンドウが乖離率です。

え、ボリンジャーバンドを見るから要らない!?

プログラムソース

//+------------------------------------------------------------------+
//|                          yasciiKairi01.mq4 
//+------------------------------------------------------------------+

#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Orange
#property indicator_color2 Violet
#property indicator_level1   0

//---- input parameters
extern int  MA_period = 20;
extern int  Sig_period = 9;
extern int MA_method = 0; // SMA(0), EMA(1), SMMA(2), LWMA(3)

//---- buffers

double kairi[];
double kairiX[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
 {
//---- indicators
  IndicatorBuffers(2);
  IndicatorShortName("Kairi(" + MA_period + ")");
  SetIndexStyle(0, DRAW_LINE);
  SetIndexBuffer(0, kairi);
  SetIndexBuffer(1, kairiX);
  SetIndexStyle(1, DRAW_LINE);

 //----
  return(0);
 }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
 {
 //----
  return(0);
 }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int counted_bars = IndicatorCounted();
   int i, j, limit ;

// to prevent possible error
   if(counted_bars < 0)
     {
       return(-1);
     }
   if(MA_method >= 4)
     {
       MA_method = 0;
     }

   limit = Bars - counted_bars;

   for(i = limit - MA_period ; i >= 0; i--)
     {
       double sma20 = iMA(NULL, 0, MA_period, 0 , MA_method , PRICE_CLOSE, i) ;
       kairi[i] = 100.0 * (Close[i]- sma20) / sma20 ;
      }

   for(j = limit - MA_period - Sig_period; j >= 0; j--)
      {
        kairiX[j] = iMAOnArray(kairi,0,Sig_period,0,MODE_EMA,j);
      }

   return(0);
  }
//+------------------------------------------------------------------+

###

web-keepers Windows VPS についてのトラブル(2)

昨年年末から利用している Windows VPS(仮想専用サーバー)の web-keepers のトラブルですが、先週末のメンテナンス以降、MetaTrader4 は一度も落ちていません。

奇跡的、というかこれが当たり前の姿のはずです。

メンテ後のデモ口座での自動売買の成績は、

2/23 10:00:00 buy 1 usdjpy 119.217 2/23 13:32:45 119.071 -14600
2/23 11:00:00 sell 1 eurjpy 135.305 2/23 13:41:16 134.64 66500
2/23 12:00:00 buy 1 gbpjpy 183.275 2/24 06:11:29 183.796 52100
2/23 13:00:00 sell 1 gbpjpy 182.699 2/23 15:44:32 183.151 -45200
2/24 18:00:00 sell 1 gbpjpy 184.241 2/25 01:00:00 183.858 38300
2/25 04:00:00 sell 1 eurjpy 134.635 2/25 09:00:00 134.816 -18100
2/25 10:00:00 buy 1 eurjpy 135.154 2/25 13:00:00 134.827 -32700
2/26 00:00:24 sell 1 eurjpy 135.018 2/26 02:38:05 135.153 -13500

 

ポンド円とユーロ円ばっかりですが、差し引き 32800円と出入りの激しい相場です。

ギリシャ問題のせいでしょうか。

ドル円は一向にチャンスが来ない(トレンドが出ない)みたいですね。

関連記事

web-keepers Windows VPS についてのトラブル

###