-
-
Save ronta-trader/5a7dc29ad69ff9defd2f3a94da54c2e6 to your computer and use it in GitHub Desktop.
ハイローオーストラリア自動売買システム①
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#property strict // コンパイルのモード | |
input int EXIT_TIME_M = 5; // 決済時間(分) | |
int Pos = 0; // ポジション確認用 | |
int Count = 1; // 矢印カウント用 | |
datetime Entry_time = 0; // エントリー時間 | |
int OnInit() | |
{ | |
return(INIT_SUCCEEDED); | |
} | |
void OnTick() | |
{ | |
double rsi1 = iRSI(NULL, 0, 14, PRICE_CLOSE, 1); // 1本前のRSI | |
double rsi2 = iRSI(NULL, 0, 14, PRICE_CLOSE, 2); // 2本前のRSI | |
if(Pos == 0 && rsi2 > 30 && rsi1 < 30) // ポジションなし & 2本前のRSI>20 & 1本前のRSI<20 | |
{ | |
Pos = 1; // ポジションありの状態に変更 | |
Entry_time = Time[0]; // エントリー時刻を記録 | |
ObjectCreate(ChartID(), "Signal" + IntegerToString(Count), OBJ_ARROW_UP, 0, Time[1], Low[1] - 10 * Point); // 上矢印(矢印番号はCount)を表示 | |
Count = Count + 1; // 矢印番号に1を追加 | |
} | |
if(Pos == 0 && rsi2 < 70 && rsi1 > 70) // ポジションなし & 2本前のRS<80 & 1本前のRSI>80 | |
{ | |
Pos = 1; // ポジションありの状態に変更 | |
Entry_time = Time[0]; // エントリー時刻を記録 | |
ObjectCreate(ChartID(), "Signal" + IntegerToString(Count), OBJ_ARROW_DOWN, 0, Time[1], High[1] + 10 * Point); // 下矢印(矢印番号はCount)を表示 | |
Count = Count + 1; // 矢印番号に1を追加 | |
} | |
if(Pos == 1 && (TimeCurrent() - Entry_time) >= (EXIT_TIME_M * 60)) // ポジションある & (EXIT_TIME_M)分以上経過していたら | |
{ | |
Pos = 0; // ポジションなしの状態に変更 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment