メタトレーダーで聖杯探し

メタトレーダーを使い倒して、聖杯を見つけます。 ほったらかしシストレFXで、目指すは1億円!! 自動売買用オリジナルEA公開中。

バックテストの疑似Tickは、毎回同じTickを刻むのか?

検証してみました。

EA

//+------------------------------------------------------------------+

//| TickChecker.mq4 |

//| EA作成代行 シストレパートナーズ |

//| http://sistrepertners.sakura.ne.jp/ |

//+------------------------------------------------------------------+

#property copyright "EA作成代行 シストレパートナーズ"

#property link "http://sistrepertners.sakura.ne.jp/"

#property version "1.00"

#property strict

//+------------------------------------------------------------------+

//| インクルード定義 |

//+------------------------------------------------------------------+

#include

#include

//+------------------------------------------------------------------+

//| 定数 |

//+------------------------------------------------------------------+

//+------------------------------------------------------------------+

//| パラメータ |

//+------------------------------------------------------------------+

//+------------------------------------------------------------------+

//| グローバル変数 |

//+------------------------------------------------------------------+

int G_TickNum;

datetime G_TickTime;

//+------------------------------------------------------------------+

//| 初期処理 |

//+------------------------------------------------------------------+

int OnInit()

{

G_TickTime = 0;

return(INIT_SUCCEEDED);

}

//+------------------------------------------------------------------+

//| 終了処理 |

//+------------------------------------------------------------------+

void OnDeinit(const int reason)

{

}

//+------------------------------------------------------------------+

//| Expert tick function |

//+------------------------------------------------------------------+

void OnTick()

{

// 足が確定したら

if (G_TickTime != Time[0])

{

// Tick数を初期化

G_TickNum = 0;

G_TickTime = Time[0];

}

// ログに出力

Print("Tick Price[" + IntegerToString(G_TickNum) + "] = " + DoubleToStr(Bid, Digits));

// Tick数をカウント

G_TickNum++;

}

結果(1回目)

2 12:57:21.631 2017.10.01 00:00:00 TickChecker test started

0 12:57:21.632 2017.10.02 00:00:00 TickChecker USDJPY,M15: Tick Price[0] = 112.649

0 12:57:21.632 2017.10.02 00:00:03 TickChecker USDJPY,M15: Tick Price[1] = 112.647

0 12:57:21.632 2017.10.02 00:00:06 TickChecker USDJPY,M15: Tick Price[2] = 112.644

0 12:57:21.632 2017.10.02 00:00:09 TickChecker USDJPY,M15: Tick Price[3] = 112.642

0 12:57:21.632 2017.10.02 00:00:12 TickChecker USDJPY,M15: Tick Price[4] = 112.639

0 12:57:21.632 2017.10.02 00:00:16 TickChecker USDJPY,M15: Tick Price[5] = 112.637

0 12:57:21.632 2017.10.02 00:00:19 TickChecker USDJPY,M15: Tick Price[6] = 112.634

0 12:57:21.632 2017.10.02 00:00:22 TickChecker USDJPY,M15: Tick Price[7] = 112.632

0 12:57:21.632 2017.10.02 00:00:25 TickChecker USDJPY,M15: Tick Price[8] = 112.630

0 12:57:21.632 2017.10.02 00:00:29 TickChecker USDJPY,M15: Tick Price[9] = 112.627

0 12:57:21.632 2017.10.02 00:00:32 TickChecker USDJPY,M15: Tick Price[10] = 112.625

:

0 12:57:21.745 2017.10.02 23:58:21 TickChecker USDJPY,M15: Tick Price[372] = 112.734

0 12:57:21.745 2017.10.02 23:58:23 TickChecker USDJPY,M15: Tick Price[373] = 112.735

0 12:57:21.745 2017.10.02 23:58:25 TickChecker USDJPY,M15: Tick Price[374] = 112.733

0 12:57:21.745 2017.10.02 23:58:27 TickChecker USDJPY,M15: Tick Price[375] = 112.734

0 12:57:21.745 2017.10.02 23:58:30 TickChecker USDJPY,M15: Tick Price[376] = 112.733

0 12:57:21.745 2017.10.02 23:58:32 TickChecker USDJPY,M15: Tick Price[377] = 112.732

0 12:57:21.745 2017.10.02 23:58:34 TickChecker USDJPY,M15: Tick Price[378] = 112.733

0 12:57:21.745 2017.10.02 23:58:36 TickChecker USDJPY,M15: Tick Price[379] = 112.731

0 12:57:21.745 2017.10.02 23:58:37 TickChecker USDJPY,M15: Tick Price[380] = 112.732

0 12:57:21.745 2017.10.02 23:58:41 TickChecker USDJPY,M15: Tick Price[381] = 112.731

0 12:57:21.745 2017.10.02 23:58:43 TickChecker USDJPY,M15: Tick Price[382] = 112.730

0 12:57:21.745 2017.10.02 23:58:44 TickChecker USDJPY,M15: Tick Price[383] = 112.739

結果(2回目)

2 12:57:48.751 2017.10.01 00:00:00 TickChecker test started

0 12:57:48.751 2017.10.02 00:00:00 TickChecker USDJPY,M15: Tick Price[0] = 112.649

0 12:57:48.751 2017.10.02 00:00:03 TickChecker USDJPY,M15: Tick Price[1] = 112.647

0 12:57:48.751 2017.10.02 00:00:06 TickChecker USDJPY,M15: Tick Price[2] = 112.644

0 12:57:48.751 2017.10.02 00:00:09 TickChecker USDJPY,M15: Tick Price[3] = 112.642

0 12:57:48.751 2017.10.02 00:00:12 TickChecker USDJPY,M15: Tick Price[4] = 112.639

0 12:57:48.751 2017.10.02 00:00:16 TickChecker USDJPY,M15: Tick Price[5] = 112.637

0 12:57:48.751 2017.10.02 00:00:19 TickChecker USDJPY,M15: Tick Price[6] = 112.634

0 12:57:48.751 2017.10.02 00:00:22 TickChecker USDJPY,M15: Tick Price[7] = 112.632

0 12:57:48.751 2017.10.02 00:00:25 TickChecker USDJPY,M15: Tick Price[8] = 112.630

0 12:57:48.751 2017.10.02 00:00:29 TickChecker USDJPY,M15: Tick Price[9] = 112.627

0 12:57:48.751 2017.10.02 00:00:32 TickChecker USDJPY,M15: Tick Price[10] = 112.625

:

0 12:57:48.866 2017.10.02 23:58:21 TickChecker USDJPY,M15: Tick Price[372] = 112.734

0 12:57:48.866 2017.10.02 23:58:23 TickChecker USDJPY,M15: Tick Price[373] = 112.735

0 12:57:48.866 2017.10.02 23:58:25 TickChecker USDJPY,M15: Tick Price[374] = 112.733

0 12:57:48.866 2017.10.02 23:58:27 TickChecker USDJPY,M15: Tick Price[375] = 112.734

0 12:57:48.866 2017.10.02 23:58:30 TickChecker USDJPY,M15: Tick Price[376] = 112.733

0 12:57:48.866 2017.10.02 23:58:32 TickChecker USDJPY,M15: Tick Price[377] = 112.732

0 12:57:48.866 2017.10.02 23:58:34 TickChecker USDJPY,M15: Tick Price[378] = 112.733

0 12:57:48.866 2017.10.02 23:58:36 TickChecker USDJPY,M15: Tick Price[379] = 112.731

0 12:57:48.866 2017.10.02 23:58:37 TickChecker USDJPY,M15: Tick Price[380] = 112.732

0 12:57:48.866 2017.10.02 23:58:41 TickChecker USDJPY,M15: Tick Price[381] = 112.731

0 12:57:48.866 2017.10.02 23:58:43 TickChecker USDJPY,M15: Tick Price[382] = 112.730

0 12:57:48.866 2017.10.02 23:58:44 TickChecker USDJPY,M15: Tick Price[383] = 112.739

全く同じTickを刻んでいる事がわかります。

良く考えると、毎回違ったTickが刻まれたりしたら「バックテスト結果が毎回違う!?」なんて事態も発生し得る訳で、当然といえば当然ですね。