FXでトレードする際にMT4を使っています。その際に曜日を表示する簡単なインジケータが欲しいのですがMQL4の知識がありません。初歩的な質問かも知れませんが分かる人いればよろしくお願いします。
実現したいこと
サーバー時刻の曜日を取得する際に出た戻り値?(0,1,2,3,4,5,6)を(0:日曜日 1:月曜日 ・・・5:金曜日 6:土曜日)といった具合に出したいです。今のままだと(0,1,2,3,4,5,6)で出力されます。
該当のソースコード
#property copyright ""
#property link ""
#property indicator_chart_window
extern color BrokerTimeColor_2=Red;
extern int DistanceFromTopLeft_2=260;
extern double ZoomLevel_2=1;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
ObjectCreate("Label_bt_2", OBJ_LABEL, 0, 0, 0); // Creating obj.
ObjectSet("Label_bt_2", OBJPROP_CORNER, 0); // Reference corner
ObjectSet("Label_bt_2", OBJPROP_XDISTANCE, DistanceFromTopLeft_2ZoomLevel_2);// X coordinate
ObjectSet("Label_bt_2", OBJPROP_YDISTANCE, 30ZoomLevel_2);// Y coordinate
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
//----
ObjectSetText("Label_bt_2",DayOfWeek(),20*ZoomLevel_2,"Arial",BrokerTimeColor_2);
//----
return(0);
}
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
ObjectDelete("Label_bt");
//----
return(0);
}
//+------------------------------------------------------------------+
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2022/04/09 18:14