98 lines
No EOL
8 KiB
Text
98 lines
No EOL
8 KiB
Text
//6桁のFX通貨ペアなら変換可。CFDなど6文字以外のものは検知しない。
|
|
|
|
//チャートセット固定用
|
|
string SYMBOL1 = "GBPJPY"; // シンボル名(頭6文字)
|
|
//string SYMBOL2 = "GOLD"; // シンボル名(頭4文字)
|
|
int Chart_TimeFrame = PERIOD_M15; // タイムフレーム
|
|
|
|
|
|
int OnInit()
|
|
{
|
|
// チャート自動変更・シンボル・チャートコメント・EA名・状態表示
|
|
if (!IsTesting())
|
|
{
|
|
ChartSet(); // チャート自動変更
|
|
CenterSymbol(); // 中央のシンボル
|
|
ChartComment(); // チャートコメント
|
|
EA_name(); // EA名アレンジ
|
|
EA_test(); // 状態表示
|
|
EventSetTimer(60); // 状態表示
|
|
}
|
|
}
|
|
|
|
//+------------------------------------------------------------------+
|
|
//| チャート自動セット(初期化工程) |
|
|
//+------------------------------------------------------------------+
|
|
void ChartSet()
|
|
{
|
|
// 気配値強制表示&自動切替
|
|
int chartWidth = (int)ChartGetInteger(0, CHART_WIDTH_IN_PIXELS); // チャート幅の計算
|
|
int textWidth = 200;//StringLen(WindowExpertName()) * 12; // 固定値pxまたはテキストの幅の計算
|
|
double ShiftPer = textWidth * 100 / chartWidth;
|
|
|
|
if (!IsTesting())
|
|
{
|
|
if (StringSubstr(Symbol(), 0, 6) != SYMBOL1 || Period() != Chart_TimeFrame)
|
|
{
|
|
SymbolSelect(SYMBOL1 + StringSubstr(Symbol(), 6, StringLen(Symbol())), true);
|
|
ChartSetSymbolPeriod(0, SYMBOL1 + StringSubstr(Symbol(), 6, StringLen(Symbol())), Chart_TimeFrame);
|
|
}
|
|
// 現在のシンボルが4文字の場合。無しならコメントアウト
|
|
/*if (StringSubstr(Symbol(), 0, 4) != SYMBOL2 || Period() != Chart_TimeFrame)
|
|
{
|
|
SymbolSelect(SYMBOL2 + StringSubstr(Symbol(), StringSubstr(Symbol(), 0, 4) == SYMBOL2? 4 : 6, StringLen(Symbol())), true);
|
|
ChartSetSymbolPeriod(0, SYMBOL2 + StringSubstr(Symbol(), StringSubstr(Symbol(), 0, 4) == SYMBOL2? 4 : 6, StringLen(Symbol())), Chart_TimeFrame);
|
|
}*/
|
|
ChartSetInteger(0, CHART_COLOR_BACKGROUND, clrBlack);
|
|
ChartSetInteger(0, CHART_COLOR_FOREGROUND, clrWhite);
|
|
ChartSetInteger(0, CHART_COLOR_GRID, clrLightSlateGray);
|
|
ChartSetInteger(0, CHART_COLOR_CHART_UP, clrOlive);
|
|
ChartSetInteger(0, CHART_COLOR_CHART_DOWN, clrOlive);
|
|
ChartSetInteger(0, CHART_COLOR_CANDLE_BULL, clrBlack);
|
|
ChartSetInteger(0, CHART_COLOR_CANDLE_BEAR, clrBeige);
|
|
ChartSetInteger(0, CHART_COLOR_CHART_LINE, clrOlive);
|
|
ChartSetInteger(0, CHART_COLOR_VOLUME, clrOlive);
|
|
ChartSetInteger(0, CHART_COLOR_ASK, clrRed);
|
|
ChartSetInteger(0, CHART_COLOR_STOP_LEVEL, clrRed);
|
|
ChartSetInteger(0, CHART_SHIFT, true);
|
|
ChartSetDouble(0, CHART_SHIFT_SIZE, ShiftPer);
|
|
ChartSetInteger(0, CHART_AUTOSCROLL, true);
|
|
//ChartSetInteger(0, CHART_SHOW_DATE_SCALE, true); // これを入れるとなぜか表示範囲が狭くなる
|
|
//ChartSetInteger(0, CHART_SHOW_PRICE_SCALE, true); // これを入れるとなぜか表示範囲が狭くなる
|
|
ChartSetInteger(0, CHART_FOREGROUND, false);
|
|
ChartSetInteger(0, CHART_SHOW_GRID, false);
|
|
ChartSetInteger(0, CHART_SHOW_ONE_CLICK, false);
|
|
ChartSetInteger(0, CHART_SHOW_OHLC, false);
|
|
ChartSetInteger(0, CHART_SHOW_PERIOD_SEP, true);
|
|
ChartSetInteger(0, CHART_SHOW_ASK_LINE, true);
|
|
ChartSetInteger(0, CHART_SCALE, 3);
|
|
ChartSetInteger(0, CHART_MODE, CHART_CANDLES);
|
|
}
|
|
}
|
|
//+------------------------------------------------------------------+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// アルマダさんの設定
|
|
ChartSetInteger(0, CHART_SHOW_DATE_SCALE, true);
|
|
ChartSetInteger(0, CHART_SHOW_PRICE_SCALE, false);
|
|
ChartSetInteger(0, CHART_FOREGROUND, false);
|
|
ChartSetInteger(0, CHART_SHOW_GRID, false);
|
|
ChartSetInteger(0, CHART_SHOW_ONE_CLICK, false);
|
|
ChartSetInteger(0, CHART_SHOW_OHLC, false);
|
|
ChartSetInteger(0, CHART_COLOR_FOREGROUND, clrLightGray);
|
|
ChartSetInteger(0, CHART_COLOR_BACKGROUND, clrBlack);
|
|
ChartSetInteger(0, CHART_COLOR_CANDLE_BEAR, clrBlack);
|
|
ChartSetInteger(0, CHART_COLOR_CANDLE_BULL, clrDarkGray);
|
|
ChartSetInteger(0, CHART_COLOR_CHART_DOWN, clrDimGray);
|
|
ChartSetInteger(0, CHART_COLOR_CHART_UP, clrDimGray);
|
|
ChartSetInteger(0, CHART_COLOR_CHART_LINE, clrDimGray);
|
|
ChartSetInteger(0, CHART_SHIFT, true); |