• 締切済み

これは文字化けしている状態なのでしょうか?

//+------------------------------------------------------------------+ //| Indexes_v7L.mq4 | //| Copyright ゥ 2008, Xupypr | //+------------------------------------------------------------------+ #property copyright "Copyright ゥ 2008, Xupypr" #property indicator_separate_window #property indicator_buffers 8 #property indicator_level1 100 #property indicator_level2 -100 #property indicator_levelcolor LightSlateGray #property indicator_color1 Lime #property indicator_color2 DodgerBlue #property indicator_color3 Red #property indicator_color4 Yellow #property indicator_color5 DeepPink #property indicator_color6 DarkOrange #property indicator_color7 MediumSpringGreen #property indicator_color8 LightSkyBlue #property indicator_width1 1 #property indicator_width2 1 #property indicator_width3 1 #property indicator_width4 1 #property indicator_width5 1 #property indicator_width6 1 #property indicator_width7 1 #property indicator_width8 1 //---- input parameters extern string start_time="2006.12.29 22:59"; // ・iv (・淲・糂・竟蒟・・粹・100%) extern bool use_start_time=false; // 頌・・鉋籵 ・iv, 竟璞・碣瑣・燾 鈞・靑・ 淲蒟・ extern bool auto_detect_pair=false; // i蒟・ 珞・・籵・・ ・ ・iv髜赳 iv粢糒・竟蒟・・ extern bool diff_indicators=false; // 頸瑣・鈿iii 竟蒟・魵/竟蒻・・・跖・ "珞i蒟・湜" ・ extern bool reverse_index=false; // "・粽籵" 竟蒟・ 籵・, ・・・・ 糘ii鵫 extern int applied_price=0; // 頌・・銛褌・ 浯: 0-CLOSE; 1-OPEN; 2-HIGH; 3-LOW; 4-MEDIAN; 5-TYPICAL; 6-WEIGHTED; extern int ma_period=1; // ・鮏 蓖褊・ 蓁 糺褊・ 鸙・胛 裝淲胛 extern int ma_method=3; // ・・蓖褊・: 0-MODE_SMA; 1-MODE_EMA; 2-MODE_SMMA; 3-MODE_LWMA extern int select_indicator=0; // 0-竟蒟・・籵・・砒・竟蒻・・ 1-CCI; 2-RSI; 3-Momentum; 4-MACD; 5-Stochastic; extern int period_indicator=14; // ・鮏 蓖褊・ 蓁 糺褊・ 竟蒻・ extern int fast_EMA=12; // 蓁 竟蒻・ MACD extern int slow_EMA=26; // 蓁 竟蒻・ MACD extern int k_period=5; // 蓁 竟蒻・ Stochastic extern int slowing=3; // 蓁 竟蒻・ Stochastic extern bool show_USD=true; extern bool show_EUR=true; extern bool show_GBP=true; extern bool show_JPY=true; extern bool show_CHF=true; extern bool show_AUD=true; extern bool show_CAD=true; extern bool show_NZD=true; //---- buffers double iUSDBuffer[]; double iEURBuffer[]; double iGBPBuffer[]; double iJPYBuffer[]; double iCHFBuffer[]; double iAUDBuffer[]; double iCADBuffer[]; double iNZDBuffer[]; double xUSDBuffer[]; double xEURBuffer[]; double xGBPBuffer[]; double xJPYBuffer[]; double xCHFBuffer[]; double xAUDBuffer[]; double xCADBuffer[]; double xNZDBuffer[]; //---- indicator buffers double USDBuffer[]; double EURBuffer[]; double GBPBuffer[]; double JPYBuffer[]; double CHFBuffer[]; double AUDBuffer[]; double CADBuffer[]; double NZDBuffer[]; //---- indicator parameters int i,BarsCS,LB; bool Show_CUR[8],Stop=false; double SPrice[7]; string CS1,CS2; string Currency[8]={"USD","EUR","GBP","JPY","CHF","AUD","CAD","NZD"}; string Symbols[7]={"AUDUSD","EURUSD","GBPUSD","NZDUSD","USDCAD","USDCHF","USDJPY"}; datetime Period_End,SPoint; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { int SBar,STime[8]; bool Show=false; string Name; Comment(""); if (Period()==PERIOD_MN1) { Comment("マ褞韶・淲 ・趺・磊 碚・ W1"); Stop=true; return(-1); } if (auto_detect_pair) { ArrayInitialize(Show_CUR,false); CS1=StringSubstr(Symbol(),0,3); CS2=StringSubstr(Symbol(),3,3); for (i=0;i<8;i++) { if (Currency[i]==CS1 || Currency[i]==CS2) { Show_CUR[i]=true; Show=true; } } if (Show==false) { ArrayInit

みんなの回答

  • bardfish
  • ベストアンサー率28% (5029/17765)
回答No.1

文字化けではなく、文字コードが一致していないだけだと思います。 そのテキストを作成した人の文字コードと、開いた人の文字コードが一致していないとそういうことが起こります。 日本語ならJISコードとS-JISコードの違いがあるし、場合によっては中国、韓国のバイト文字かも知れない。 HTMLのように文字コードの指定がないプレーンテキストではよくあることです。

Alico_dego
質問者

補足

ありがとうございます。 さてどうしたら直るのか?  今、調べてみたのですがメールを読解するタイプは よくあるのですが、プログラムが表示されない。 というか動かないのです。  MT4のインジケーターですが、、、(^^; 何かよい変換ソフトはないでしょうか?

関連するQ&A

  • MT4 BollingerBands

    下記のように±σ1をDOT表示にプログラムしているのですが、DOTではなくSOLIDになります。何がいけないか、プログラムに詳しい方、教えてください。 #property indicator_chart_window #property indicator_buffers 3 #property indicator_color1 Black #property indicator_width1 2 #property indicator_color2 Teal #property indicator_width2 0 #property indicator_color3 Teal #property indicator_width3 0 //---- indicator parameters extern int BandsPeriod=20; extern int BandsShift=0; extern double BandsDeviations=1.0; //---- buffers double MovingBuffer[]; double UpperBuffer[]; double LowerBuffer[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0,DRAW_LINE,STYLE_SOLID); SetIndexBuffer(0,MovingBuffer); SetIndexStyle(1,DRAW_LINE,STYLE_DOT); SetIndexBuffer(1,UpperBuffer); SetIndexStyle(2,DRAW_LINE,STYLE_DOT); SetIndexBuffer(2,LowerBuffer);

  • MACD_Cross_Alert.mq4

    下記、MACDのプログラム、私としてはMACDライン、シグナルラインともにEMAを使いたいのですが、プログラムのどこがおかしいのか、EMAのMACD(Alertなし)と比べると全然表示が違います。どなたか詳しい方、変更の仕方を教えてください。(プログラムがわからないのでどこがおかしいのか・・・) #property indicator_separate_window #property indicator_buffers 2 #property indicator_color1 DeepSkyBlue #property indicator_width1 2 #property indicator_color2 Red #property indicator_width2 2 #property indicator_level1 0 #property indicator_levelcolor White //---- input parameters extern int fast_Period = 12; extern int slow_Period = 26; extern int signal_Period = 9; extern string AlertSound = "alert.wav"; //---- buffers double Buffer1[]; double Buffer2[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0,DRAW_LINE,1,2); SetIndexBuffer(0,Buffer1); SetIndexLabel(0,"Main"); SetIndexStyle(1,DRAW_LINE); SetIndexBuffer(1,Buffer2); SetIndexLabel(1,"Signal"); //---- return(0);} //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() {int counted_bars = IndicatorCounted(); int limit = Bars - counted_bars; for(int i=0; i < limit; i++) {Buffer1[i] = iMACD(NULL, 0, fast_Period, slow_Period,signal_Period, PRICE_CLOSE,MODE_MAIN , i); Buffer2[i] = iMACD(NULL, 0, fast_Period, slow_Period,signal_Period, PRICE_CLOSE,MODE_SIGNAL , i); } if(Buffer1[1] < Buffer2[1] && Buffer1[0] > Buffer2[0]) { PlaySound(AlertSound); ObjectDelete("BuySignal"); ObjectCreate("BuySignal",OBJ_ARROW,0 ,Time[0] ,Low[0]-10*Point); ObjectSet("BuySignal",OBJPROP_ARROWCODE, 217); ObjectSet("BuySignal",OBJPROP_COLOR, Blue); } else if(Buffer1[1] > Buffer2[1] && Buffer1[0] < Buffer2[0]) {PlaySound(AlertSound); ObjectDelete("SellSignal"); ObjectCreate("SellSignal",OBJ_ARROW,0 ,Time[0] ,High[0]+10*Point); ObjectSet("SellSignal",OBJPROP_ARROWCODE, 218); ObjectSet("SellSignal",OBJPROP_COLOR, Red); } //Comment ("MAIN: ",Buffer1[0]," / SIGNAL: ",Buffer2[0]); return(0);} //+------------------------------------------------------------------+

  • MACD

    下記、MACDを表示するとMACDラインは、EMA表示だと思うのですが、SignalラインがSMAで表示されているような気がします。プログラム上、EMA、SMAの表記がないので、どこを変更すれば、SignalラインがEMAになるのかわかるかた教えてください。 #property indicator_separate_window #property indicator_buffers 2 #property indicator_color1 DeepSkyBlue #property indicator_width1 2 #property indicator_color2 Red #property indicator_width2 2 #property indicator_level1 0 #property indicator_levelcolor White //---- input parameters extern int fast_Period = 12; extern int slow_Period = 26; extern int signal_Period = 9; extern string AlertSound = "alert.wav"; //---- buffers double Buffer1[]; double Buffer2[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0,DRAW_LINE,1,2); SetIndexBuffer(0,Buffer1); SetIndexLabel(0,"Main"); SetIndexStyle(1,DRAW_LINE); SetIndexBuffer(1,Buffer2); SetIndexLabel(1,"Signal"); //---- return(0);} //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() {int counted_bars = IndicatorCounted(); int limit = Bars - counted_bars; for(int i=0; i < limit; i++) {Buffer1[i] = iMACD(NULL, 0, fast_Period, slow_Period,signal_Period, PRICE_CLOSE,MODE_MAIN , i); Buffer2[i] = iMACD(NULL, 0, fast_Period, slow_Period,signal_Period, PRICE_CLOSE,MODE_SIGNAL , i); } if(Buffer1[1] < Buffer2[1] && Buffer1[0] > Buffer2[0]) { PlaySound(AlertSound); ObjectDelete("BuySignal"); ObjectCreate("BuySignal",OBJ_ARROW,0 ,Time[0] ,Low[0]-10*Point); ObjectSet("BuySignal",OBJPROP_ARROWCODE, 217); ObjectSet("BuySignal",OBJPROP_COLOR, Blue); } else if(Buffer1[1] > Buffer2[1] && Buffer1[0] < Buffer2[0]) {PlaySound(AlertSound); ObjectDelete("SellSignal"); ObjectCreate("SellSignal",OBJ_ARROW,0 ,Time[0] ,High[0]+10*Point); ObjectSet("SellSignal",OBJPROP_ARROWCODE, 218); ObjectSet("SellSignal",OBJPROP_COLOR, Red); } //Comment ("MAIN: ",Buffer1[0]," / SIGNAL: ",Buffer2[0]); return(0);} //+------------------------------------------------------------------+

  • MT4 BBandWidthRatio(VT系)

    fhat6014様 この質問の前にADXのMTF化の質問をしているのですが、貴殿に以前紹介頂いた、BBandWidthRatioのVT系のインジケータもMTF化できるのでしょうか?現在、紹介頂いたサイトからインジケータが削除されているため、プログラムを記載させて頂きます。可能であれば、教えていただけないでしょうか。 #property indicator_separate_window #property indicator_buffers 3 #property indicator_color1 Purple #property indicator_color2 Blue #property indicator_color3 Red #property indicator_style2 STYLE_DOT #property indicator_style3 STYLE_DOT #property indicator_minimum 0 //---- input parameters extern int BB_Period=18; extern double Deviation=2.0; extern int Bulgeper=150; extern int Squeezeper=150; double buf1[]; //double buf2[]; //double buf3[]; //double buf4[]; double bufBulgeper[]; double bufSqueezeper[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { IndicatorDigits(MarketInfo(Symbol(), MODE_DIGITS)); SetIndexDrawBegin(0,BB_Period); SetIndexLabel(0,"BBandWidthRatio"); SetIndexBuffer(0, buf1); SetIndexDrawBegin(1,BB_Period); SetIndexLabel(1,"Bulgeper"); SetIndexBuffer(1, bufBulgeper); SetIndexDrawBegin(2,BB_Period); SetIndexLabel(2,"Squeezeper"); SetIndexBuffer(2, bufSqueezeper); return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int i, j; double ave, sko, sum; int counted_bars=IndicatorCounted(); double MA, Up, Dn; if(Bars<=BB_Period) return(0); if(BB_Period==0) return(0); int limit = Bars - counted_bars; for (i=limit-1; i>=0; i--) { // buf2[i] = iMA(NULL,0,BB_Period,0,MODE_SMA,PRICE_CLOSE,i); MA = iMA(NULL,0,BB_Period,0,MODE_SMA,PRICE_CLOSE,i); sum = 0; for (j=0; j<BB_Period; j++) sum+=Close[i+j]; ave = sum / BB_Period; sum = 0; for (j=0; j<BB_Period; j++) sum+=(Close[i+j]-ave)*(Close[i+j]-ave); sko = MathSqrt(sum / BB_Period); // buf4[i] = buf2[i]+(Deviation*sko); // buf3[i] = buf2[i]-(Deviation*sko); Up = MA+(Deviation*sko); Dn = MA-(Deviation*sko); // buf1[i] = 2*(Deviation*sko)/buf2[i]; if( MA != 0 ){ buf1[i] = 2*(Deviation*sko)/MA; bufBulgeper[i] = buf1[ArrayMaximum(buf1,Bulgeper,i)]; bufSqueezeper[i] = buf1[ArrayMinimum(buf1,Squeezeper,i)]; } } return(0); }

  • 〔MQL4〕MT4で指標を作成しています。

    はじめまして。 MQLで指標を作成しています。 どうしてもわからない事があるので、初歩的な事だと思いますが質問させていただきます。 組み込み関数のiATRを利用しています。 短期間のiATRと長期間のiATRを算出し、最終的に短期ATRを長期ATRで割りたいのです。 以下のMQLを入力しましたが、最新のバーでの計算結果のみしか表示されません。 start内のatr3[i] = atr1[i] / atr2[i];を消去すると短期と長期のATRだけは過去分も表示されました。 どなたかわかる方、教えてください。。 #property indicator_buffers 3 #property indicator_separate_window #property indicator_color1 Red #property indicator_color2 Blue #property indicator_color3 Yellow double atr1[];//短期ATR double atr2[];//長期ATR double atr3[];//短期ATR/長期ATR extern int atr1_period=5; extern int atr2_period=10; int init() { SetIndexBuffer(0,atr1); SetIndexBuffer(1,atr2); SetIndexBuffer(2,atr3); SetIndexLabel(0,"atr1"); SetIndexLabel(1,"atr2"); SetIndexLabel(2,"atr1/atr2"); return(0); } int start() { int limit=Bars-IndicatorCounted(); for(int i=limit-1; i>=0; i--) { atr1[i]=iATR(NULL,0,atr1_period,i); atr2[i]=iATR(NULL,0,atr2_period,i); atr3[i] = atr1[i] / atr2[i]; } return(0); }

  • MT4 MACD

    下記、MACDのプログラムですが、MACDラインとSignalラインがクロスした際、(1)-(3)の条件を満たす、プログラム変更を、どなたか、詳しい方教えてください。 (1)Alertを鳴らす (2)Soundを1度鳴らす (3)Soundを鳴らし続ける #property copyright "Copyright ゥ 2005, David W. Thomas" #property link "mailto:davidwt@usa.net" #property indicator_separate_window #property indicator_buffers 5 #property indicator_color1 Blue #property indicator_color2 Red #property indicator_color3 Green #property indicator_color4 DeepPink #property indicator_width4 2 #property indicator_color5 Aqua #property indicator_width5 2 //---- input parameters extern int FastMAPeriod=12; extern int SlowMAPeriod=26; extern int SignalMAPeriod=9; extern bool ShowSignal = false; extern double SignalDiff = 0.000175; //---- buffers double MACDLineBuffer[]; double SignalLineBuffer[]; double HistogramBuffer[]; double AlertUpBuffer[]; double AlertDownBuffer[]; //---- variables double alpha = 0; double alpha_1 = 0; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS)+1); //---- indicators SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,MACDLineBuffer); SetIndexDrawBegin(0,SlowMAPeriod); SetIndexStyle(1,DRAW_LINE/*,STYLE_DOT*/); SetIndexBuffer(1,SignalLineBuffer); SetIndexDrawBegin(1,SlowMAPeriod+SignalMAPeriod); SetIndexStyle(2,DRAW_HISTOGRAM); SetIndexBuffer(2,HistogramBuffer); SetIndexDrawBegin(2,SlowMAPeriod+SignalMAPeriod); SetIndexBuffer(3,AlertDownBuffer); SetIndexDrawBegin(3,SlowMAPeriod+SignalMAPeriod); SetIndexBuffer(4,AlertUpBuffer); SetIndexDrawBegin(4,SlowMAPeriod+SignalMAPeriod); if(ShowSignal){ SetIndexStyle(3,DRAW_ARROW); SetIndexArrow(3,119); SetIndexStyle(4,DRAW_ARROW); SetIndexArrow(4,119); }else{ SetIndexStyle(3,DRAW_NONE); SetIndexStyle(4,DRAW_NONE); } //---- name for DataWindow and indicator subwindow label IndicatorShortName("MACD-VT("+FastMAPeriod+","+SlowMAPeriod+","+SignalMAPeriod+")"); SetIndexLabel(0,"MACD"); SetIndexLabel(1,"Signal"); SetIndexLabel(2,"Hist"); SetIndexLabel(3,NULL); SetIndexLabel(4,NULL); //---- alpha = 2.0 / (SignalMAPeriod + 1.0); alpha_1 = 1.0 - alpha; //---- if(StringFind(Symbol(),"JPY")!=-1) SignalDiff=SignalDiff*100; Print("SignalDiff = ",SignalDiff); return(0); } //+------------------------------------------------------------------+ //| Custor indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int limit; int counted_bars = IndicatorCounted(); //---- check for possible errors if (counted_bars<0) return(-1); //---- last counted bar will be recounted if (counted_bars>0) counted_bars--; limit = Bars - counted_bars; for(int i=limit; i>=0; i--) { MACDLineBuffer[i] = iMA(NULL,0,FastMAPeriod,0,MODE_EMA,PRICE_CLOSE,i) - iMA(NULL,0,SlowMAPeriod,0,MODE_EMA,PRICE_CLOSE,i); SignalLineBuffer[i] = alpha*MACDLineBuffer[i] + alpha_1*SignalLineBuffer[i+1]; HistogramBuffer[i] = MACDLineBuffer[i] - SignalLineBuffer[i]; if(MACDLineBuffer[i] >MACDLineBuffer[i+1]+SignalDiff ){ AlertUpBuffer[i]=MACDLineBuffer[i]; }else{ AlertUpBuffer[i]=EMPTY_VALUE; } if(MACDLineBuffer[i] <MACDLineBuffer[i+1]-SignalDiff){ AlertDownBuffer[i]=MACDLineBuffer[i]; }else{ AlertDownBuffer[i]=EMPTY_VALUE; } } //---- return(0); } //+------------------------------------------------------------------+

  • MT4 MACD

    MACDとSIGNALがクロスした際の、(1)-(3)の条件を満たす、プログラム変更を教えてください。 (1)Alertを鳴らす(2)Soundを1度鳴らす(3)Soundを鳴らし続ける #property indicator_separate_window #property indicator_buffers 5 #property indicator_color1 DeepSkyBlue #property indicator_color2 DeepPink #property indicator_color3 Green #property indicator_color4 DeepPink #property indicator_width4 2 #property indicator_color5 Aqua #property indicator_width5 2 //---- input parameters extern int FastMAPeriod=12; extern int SlowMAPeriod=26; extern string _ma = "0:SMA 1:EMA 2:SMMA 3:LWMA"; extern int MAMethod = MODE_EMA; extern int SignalMAPeriod=9; extern int SignalMAMethod = MODE_EMA; extern bool ShowSignal = false; extern double SignalDiff = 0.000175; //---- buffers double MACDLineBuffer[]; double SignalLineBuffer[]; double HistogramBuffer[]; double AlertUpBuffer[]; double AlertDownBuffer[]; //---- variables double alpha = 0; double alpha_1 = 0; //| Custom indicator initialization function | int init() { IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS)+1); //---- indicators SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,MACDLineBuffer); SetIndexDrawBegin(0,SlowMAPeriod); SetIndexStyle(1,DRAW_LINE/*,STYLE_DOT*/); SetIndexBuffer(1,SignalLineBuffer); SetIndexDrawBegin(1,SlowMAPeriod+SignalMAPeriod); SetIndexStyle(2,DRAW_HISTOGRAM); SetIndexBuffer(2,HistogramBuffer); SetIndexDrawBegin(2,SlowMAPeriod+SignalMAPeriod); SetIndexBuffer(3,AlertDownBuffer); SetIndexDrawBegin(3,SlowMAPeriod+SignalMAPeriod); SetIndexBuffer(4,AlertUpBuffer); SetIndexDrawBegin(4,SlowMAPeriod+SignalMAPeriod); if(ShowSignal){ SetIndexStyle(3,DRAW_ARROW); SetIndexArrow(3,119); SetIndexStyle(4,DRAW_ARROW); SetIndexArrow(4,119); }else{ SetIndexStyle(3,DRAW_NONE); SetIndexStyle(4,DRAW_NONE); } //---- name for DataWindow and indicator subwindow label IndicatorShortName("MACD+("+FastMAPeriod+","+SlowMAPeriod+","+SignalMAPeriod+")"); SetIndexLabel(0,"MACD"); SetIndexLabel(1,"Signal"); SetIndexLabel(2,"Hist"); SetIndexLabel(3,NULL); SetIndexLabel(4,NULL); //---- //alpha = 2.0 / (SignalMAPeriod + 1.0); //alpha_1 = 1.0 - alpha; //---- if(StringFind(Symbol(),"JPY")!=-1) SignalDiff=SignalDiff*100; Print("SignalDiff = ",SignalDiff); return(0); } //+------------------------------------------------------------------+ //| Custor indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int limit,i; int counted_bars = IndicatorCounted(); //---- check for possible errors if (counted_bars<0) return(-1); //---- last counted bar will be recounted if (counted_bars>0) counted_bars--; limit = Bars - counted_bars; for(i=limit; i>=0; i--) { MACDLineBuffer[i] = iMA(NULL,0,FastMAPeriod,0,MAMethod,PRICE_CLOSE,i) - iMA(NULL,0,SlowMAPeriod,0,MAMethod,PRICE_CLOSE,i); } for(i=limit; i>=0; i--) { //SignalLineBuffer[i] = alpha*MACDLineBuffer[i] + alpha_1*SignalLineBuffer[i+1]; SignalLineBuffer[i] = iMAOnArray(MACDLineBuffer,0,SignalMAPeriod,0,SignalMAMethod,i); HistogramBuffer[i] = MACDLineBuffer[i] - SignalLineBuffer[i]; if(MACDLineBuffer[i] >MACDLineBuffer[i+1]+SignalDiff ){ AlertUpBuffer[i]=MACDLineBuffer[i]; }else{ AlertUpBuffer[i]=EMPTY_VALUE; } if(MACDLineBuffer[i] <MACDLineBuffer[i+1]-SignalDiff){ AlertDownBuffer[i]=MACDLineBuffer[i]; }else{ AlertDownBuffer[i]=EMPTY_VALUE; } } //---- return(0);

  • MT4 MQL 自作インジの問題点がわからない…

    自作インジをiいくつか作って、そのうちいくつかに動かしているとたまにバグ?が出るモノがあるのですがどうしてそうなるのか問題点がわからないです。 MT4 MQL 上級者の方ならわかるかとおもうのですが… 理由と修正点を教えてください。 以下MQL 例 #property indicator_separate_window #property indicator_buffers 1 #property indicator_color1 DodgerBlue #property indicator_minimum 0 #property indicator_maximum 100 #property indicator_level1 30 #property indicator_level2 70 //指標バッファ double BufRSI[]; double TRDBuf[]; double haBuf[]; double haBuf2[]; //パラメーター extern int RSI_Period = 14; extern int up = 85; extern int down = 15; extern int haup = 70; extern int hadown = 30; //+------------------------------------------------------------------+ //| 初期化関数 | //+------------------------------------------------------------------+ int init() { //指標バッファの割り当て IndicatorBuffers(4); SetIndexBuffer(1,BufRSI); SetIndexBuffer(0,TRDBuf); SetIndexBuffer(2,haBuf); SetIndexBuffer(3,haBuf2); return(0); } //+------------------------------------------------------------------+ //| 指標処理関数 | //+------------------------------------------------------------------+ int start() { int limit = Bars-IndicatorCounted(); if(limit == Bars) limit -= RSI_Period-1; for(int i=limit-1; i>=0; i--) { BufRSI[i]=iRSI(NULL,0,RSI_Period,PRICE_CLOSE,i); } if(limit == Bars) limit -= RSI_Period-1; for(i=limit-1; i>=0; i--) { if (BufRSI[i+1]<haup && BufRSI[i+1]>hadown) { if(BufRSI[i]>haup) haBuf[i]=Close[i]; if(BufRSI[i]<hadown) haBuf2[i]=Close[i]; if(haBuf[i]<haBuf2[i]) int han=up; else han=down;      TRDBuf[i] = han ; } else TRDBuf[i] = down; } return(0); } これはRSI(14)が70未満から70より上になったときに haBuf[i] に終値をいれておき RSI(14)が30より上から30未満になったときに haBuf2[i] に終値をいれて haBuf[i]<haBuf2[i] だったら TRDBuf[i] を up (= 85) 違ったら down (= 15)と表示させるものです。 動かしているとたまに TRDBuf[i] が up (= 85) になるのですがプロパティーを開いて 何も変更せずにOKを押したら up (= 85) になっていたところが down (=15) になり何もなかったことになります。 (もしくは、up (= 85)がでてからまったく同じ条件のインジをいれたら新しく入れたほうは up (= 85)になっていない。) しかもこのバグ?が起こるときと起こらないときがあります。 この問題の原因がまったくわからないのですが知識のある方ご教授お願いします。

  • ポジションを同時に2個持つのを直したい

    //+------------------------------------------------------------------+ //| パラメータ | //+------------------------------------------------------------------+ extern string X = "Basic Settings"; //基本設定 extern int MagicNumber = 10011; //マジックナンバー extern double TakeProfit = 200; //リミット[pips] extern double StopLoss = 150; //ストップ[pips] extern double Lots = 0.1; //ロットサイズ extern int Cmd = OP_BUY; //エントリー方法[OP_BUY/OP_SELL] extern int Slippage = 30; //スリッページ extern string XX = "Order Settings"; //新規注文設定 extern bool CheckOrderHour = true; //時間の判定有無 extern int OrderHour = 7; //時間 extern bool CheckOrderMinute = true; //分の判定有無 extern int OrderMinute = 5; //分 extern bool CheckOrderSeconds = true; //秒の判定有無 extern int OrderSeconds = 0; //秒 extern string XXX = "Close Settings"; //決済注文設定 extern bool CheckCloseHour = true; //時間の判定有無 extern int CloseHour = 7;//時 //時間 extern bool CheckCloseMinute = true; //分の判定有無 extern int CloseMinute = 40;//分 //分 extern bool CheckCloseSeconds = true; //秒の判定有無 extern int CloseSeconds = 0;//秒 //秒 //+------------------------------------------------------------------+ //| 開始関数 | //+------------------------------------------------------------------+ int start() { if((TimeHour(TimeCurrent()) == OrderHour || CheckOrderHour == false) &&(TimeMinute(TimeCurrent()) == OrderMinute || CheckOrderMinute == false) &&(TimeSeconds(TimeCurrent()) == OrderSeconds || CheckOrderSeconds == false)) { if(Cmd == OP_BUY){ OrderSend(Symbol(), Cmd,Lots, Ask, Slippage, Ask-StopLoss*Point, Ask+TakeProfit*Point, "", MagicNumber, 0, Red); return(0); } if(Cmd == OP_SELL){ OrderSend(Symbol(), Cmd,Lots, Bid, Slippage, Bid+StopLoss*Point, Bid-TakeProfit*Point, "", MagicNumber, 0, Blue); return(0); } } if((TimeHour(TimeCurrent()) == CloseHour || CheckCloseHour == false) &&(TimeMinute(TimeCurrent()) == CloseMinute || CheckCloseMinute == false) &&(TimeSeconds(TimeCurrent()) == CloseSeconds || CheckCloseSeconds == false)) { for(int i = 0; i < OrdersTotal(); i++) { if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES) == false) { break; } if(OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber) { if(OrderType() == OP_BUY) { OrderClose(OrderTicket(), OrderLots(), Bid, Slippage, Yellow); return(0); } if(OrderType() == OP_SELL) { OrderClose(OrderTicket(), OrderLots(), Ask, Slippage, Lime); return(0); } } } } return(0); }

  • 一日2回ポジションを持つにはどうしたらいいですか?

    以前に、質問投稿した事があります。火曜から金曜日まで動かして、一日に2回だけ売買するにはどうすればいいのかわからなくて困ってます。宜しくお願いします。 --------------------------------------------------- extern string X = "Basic Settings"; //基本設定 extern int MagicNumber = 10011; //マジックナンバー extern double TakeProfit = 200; //リミット[pips] extern double StopLoss = 150; //ストップ[pips] extern double Lots = 0.1; //ロットサイズ extern int Cmd = OP_BUY; //エントリー方法[OP_BUY/OP_SELL] extern int Slippage = 30; //スリッページ extern string XX = "Order Settings"; //新規注文設定 extern bool CheckOrderDayOfWeek = false; //曜日の判定有無 extern int OrderDayOfWeek = 1; //曜日 extern bool CheckOrderHour = true; //時間の判定有無 extern int OrderHour = 7; //時間 extern bool CheckOrderMinute = true; //分の判定有無 extern int OrderMinute = 5; //分 extern bool CheckOrderSeconds = true; //秒の判定有無 extern int OrderSeconds = 0; //秒 extern string XXX = "Close Settings"; //決済注文設定 extern bool CheckCloseHour = true; //時間の判定有無 extern int CloseHour = 7;//時 //時間 extern bool CheckCloseMinute = true; //分の判定有無 extern int CloseMinute = 40;//分 //分 extern bool CheckCloseSeconds = true; //秒の判定有無 extern int CloseSeconds = 0;//秒 //秒 //+------------------------------------------------------------------+ //| 開始関数 | //+------------------------------------------------------------------+ int start() { if(OrdersTotal() == 0){ if((TimeDayOfWeek(TimeCurrent()) == OrderDayOfWeek || CheckOrderDayOfWeek == false) &&(TimeHour(TimeCurrent()) == OrderHour || CheckOrderHour == false) &&(TimeMinute(TimeCurrent()) == OrderMinute || CheckOrderMinute == false) &&(TimeSeconds(TimeCurrent()) == OrderSeconds || CheckOrderSeconds == false)) { if(Cmd == OP_BUY){ OrderSend(Symbol(), Cmd,Lots, Ask, Slippage, Ask-StopLoss*Point, Ask+TakeProfit*Point, "", MagicNumber, 0, Red); return(0); } if(Cmd == OP_SELL){ OrderSend(Symbol(), Cmd,Lots, Bid, Slippage, Bid+StopLoss*Point, Bid-TakeProfit*Point, "", MagicNumber, 0, Blue); return(0); } } } if((TimeDayOfWeek(TimeCurrent()) == OrderDayOfWeek || CheckOrderDayOfWeek == false) &&(TimeHour(TimeCurrent()) == CloseHour || CheckCloseHour == false) &&(TimeMinute(TimeCurrent()) == CloseMinute || CheckCloseMinute == false) &&(TimeSeconds(TimeCurrent()) == CloseSeconds || CheckCloseSeconds == false)) { for(int i = 0; i < OrdersTotal(); i++) { if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES) == false) { break; } if(OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber) { if(OrderType() == OP_BUY) { OrderClose(OrderTicket(), OrderLots(), Bid, Slippage, Yellow); return(0); } if(OrderType() == OP_SELL) { OrderClose(OrderTicket(), OrderLots(), Ask, Slippage, Lime); return(0); } } } } return(0); }