コーディングのヘルプ - ページ 476 1...469470471472473474475476477478479480481482483...786 新しいコメント Jovager 2015.05.21 04:57 #4751 こんにちは。 チャート上に固定テキストラベルを配置するためだけのインジケータが必要です。 モデルを見せていただけませんか? ありがとうございます。 Jo Mladen Rakic 2015.05.21 05:01 #4752 Jovager: こんにちは。チャート上に固定テキストラベルを配置するだけのインジケータが必要です。 モデルを見せていただけませんか? ありがとうございます。 ジョウ Jo あなたはこのスレッドをチェックしましたか?https://www.mql5.com/en/forum/179041 Jovager 2015.05.21 08:20 #4753 mladen: Jo このスレッドをチェックしましたか :https://www.mql5.com/en/forum/179041 Mladenです。 このスレッドの中で、まさに私が必要としている "TRO_MyNotes "をもたらすポストを発見しました。 もう一度、Mladen、あなたの助けのために多くの感謝を。 ジョウ godricha 2015.05.21 17:31 #4754 ただ、この件(投稿番号4739)について、どなたかお分かりになる方はいらっしゃいますか? ありがとうございます。 Mladen Rakic 2015.05.21 19:21 #4755 godrich: このようなことが可能かどうかわかりませんが、添付のインジケータについて、チャネルに表示される黄色い線を「真」にすることは可能でしょうか?これは、黄色い線が滑らかにならない/再計算されないという意味です。 ありがとうございます。 ゴッドリッチ それはできません。 これはHodrick/Prescottフィルターであり、その性質は再計算することです。そのような試みがなされてきましたが(たとえば、終点を尖らせる)、結果はオリジナルと似て非なるものです。 Fausto Nunziante Del Gaudio 2015.05.21 21:47 #4756 こんにちは。 私はicustom関数で 丸めたマMTFローソク足インジケータを作成しようとしています。成功せず、エラーも全くありませんが、添付のインジケータは何も表示されません。どうか助けてください。ありがとうございます。 ソースのインジケーターコードはこれです。 //+------------------------------------------------------------------+ //| MAR.mq4 | //| Copyright © 2014, Gehtsoft USA LLC | //| http://fxcodebase.com | //+------------------------------------------------------------------+ #property copyright "Copyright © 2014, Gehtsoft USA LLC" #property link "http://fxcodebase.com" #property indicator_chart_window #property indicator_buffers 3 #property indicator_color1 LimeGreen #property indicator_color2 Orange #property indicator_color3 Orange #property indicator_width1 2 #property indicator_width2 2 #property indicator_width3 2 extern int timeFrame = 0; // Time frame to use extern int Length=8; extern int Method=0; // 0 - SMA // 1 - EMA // 2 - SMMA // 3 - LWMA extern double Round=2; extern int Price=0; // Applied price // 0 - Close // 1 - Open // 2 - High // 3 - Low // 4 - Median // 5 - Typical // 6 - Weighted extern int BarsToCalculate = 0; double MAR[],MARda[],MARdb[],slope[] ; double MA[], MovAle[]; double MaRo; string indicatorFileName; bool returnBars; int init() { IndicatorShortName("Rounded ma MTF"); IndicatorBuffers(6); SetIndexBuffer(0,MAR); SetIndexBuffer(1,MARda); SetIndexBuffer(2,MARdb); SetIndexBuffer(3,MA); SetIndexBuffer(4,MovAle); SetIndexBuffer(5,slope); indicatorFileName = WindowExpertName(); returnBars = timeFrame==-999; if (returnBars) return(0); if (timeFrame==0) timeFrame= Period(); MaRo=Round*Point; return(0); } int deinit() { return(0); } int start() { int counted_bars=IndicatorCounted(); if(counted_bars<0) return(-1); if(counted_bars>0) counted_bars--; int limit = MathMin(Bars-counted_bars,Bars-1); if (returnBars) { MAR[0] = MathMin(limit+1,Bars-1); return(0); } if (timeFrame!=Period()) { limit = (int)MathMax(limit,MathMin(Bars-1,iCustom(NULL,timeFrame,indicatorFileName,-999,0,0)*timeFrame/Period())); if (BarsToCalculate>0) limit = MathMin(limit,BarsToCalculate); if (slope[limit]==-1) ClearPoint(limit,MARda,MARdb); for (int i=limit; i>=0; i--) { int y = iBarShift(NULL,timeFrame,Time); MAR = iCustom(NULL,timeFrame,indicatorFileName,0,Length,Method,Round,Price,BarsToCalculate,0,y); slope = iCustom(NULL,timeFrame,indicatorFileName,0,Length,Method,Round,Price,BarsToCalculate,5,y); MARda = EMPTY_VALUE; MARdb = EMPTY_VALUE; if (slope == -1) PlotPoint(i,MARda,MARdb,MAR); } return(0); } // // // // // if (BarsToCalculate>0) limit = MathMin(limit,BarsToCalculate); if (slope[limit]==-1) ClearPoint(limit,MARda,MARdb); for(int pos=limit; pos>=0; pos--) { MA[pos]=iMA(NULL, 0, Length, 0, Method, Price, pos); if (MA[pos]>MA[pos+1]+MaRo || MA[pos]MAR[pos+1]+MaRo || MA[pos]MAR[pos+1] && MovAle[pos+1]==1.) || (MA[pos]<MAR[pos+1] && MovAle[pos+1]==-1.)) MAR[pos]=MA[pos]; else MAR[pos]=MAR[pos+1]; if (MAR[pos]<MAR[pos+1]) MovAle[pos]=-1.; else if (MAR[pos]>MAR[pos+1]) MovAle[pos]=1.; else MovAle[pos]=MovAle[pos+1]; MARda[pos] = EMPTY_VALUE; MARdb[pos] = EMPTY_VALUE; slope[pos] = slope[pos+1]; if (MAR[pos]>MAR[pos+1]) slope[pos] = 1; if (MAR[pos]<MAR[pos+1]) slope[pos] = -1; if (slope[pos]==-1) PlotPoint(pos,MARda,MARdb,MAR); } return(0); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ // // // // // void ClearPoint(int i,double& first[],double& second[]) { if ((second != EMPTY_VALUE) && (second != EMPTY_VALUE)) second = EMPTY_VALUE; else if ((first != EMPTY_VALUE) && (first != EMPTY_VALUE) && (first == EMPTY_VALUE)) first = EMPTY_VALUE; } // // // // // void PlotPoint(int i,double& first[],double& second[],double& from[]) { if (first == EMPTY_VALUE) { if (first == EMPTY_VALUE) { first = from; first = from; second = EMPTY_VALUE; } else { second = from; second = from; first = EMPTY_VALUE; } } else { first = from; second = EMPTY_VALUE; } }[/CODE] and this is my indicator code: [CODE]//+------------------------------------------------------------------+ //| MAR.mq4 | //| Copyright © 2014, Gehtsoft USA LLC | //| http://fxcodebase.com | //+------------------------------------------------------------------+ #property copyright "Copyright © 2014, Gehtsoft USA LLC" #property link "http://fxcodebase.com" #property indicator_chart_window #property indicator_buffers 3 #property indicator_color1 LimeGreen #property indicator_color2 Orange #property indicator_color3 Orange #property indicator_width1 2 #property indicator_width2 2 #property indicator_width3 2 extern int timeFrame = 0; extern int Length = 8; extern int Method = 0; extern double Round = 2; extern int Price = 0; extern int BarsToCalculate = 0; extern color WickUpColor = DarkGreen; extern color WickDnColor = FireBrick; extern color BodyUpColor = LimeGreen; extern color BodyDnColor = Orange; extern int WickWidth = 1; extern int BodyWidth = 2; double UpBuffer[]; double DnBuffer[]; double UpbBuffer[]; double DnbBuffer[]; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int init() { SetIndexBuffer(0,UpBuffer); SetIndexStyle(0,DRAW_HISTOGRAM, EMPTY, WickWidth, WickUpColor); SetIndexBuffer(1,DnBuffer); SetIndexStyle(1,DRAW_HISTOGRAM, EMPTY, WickWidth, WickDnColor); SetIndexBuffer(2,UpbBuffer); SetIndexStyle(2,DRAW_HISTOGRAM, EMPTY, BodyWidth, BodyUpColor); SetIndexBuffer(3,DnbBuffer); SetIndexStyle(3,DRAW_HISTOGRAM, EMPTY, BodyWidth, BodyDnColor); IndicatorShortName("Rounded ma MTF candles ("+timeFrame+","+Length+","+Round+")"); Length = MathMax(Length,1); switch(timeFrame) { case 1 : string TimeFrameStr="Period_M1"; break; case 5 : TimeFrameStr="Period_M5"; break; case 15 : TimeFrameStr="Period_M15"; break; case 30 : TimeFrameStr="Period_M30"; break; case 60 : TimeFrameStr="Period_H1"; break; case 240 : TimeFrameStr="Period_H4"; break; case 1440 : TimeFrameStr="Period_D1"; break; case 10080 : TimeFrameStr="Period_W1"; break; case 43200 : TimeFrameStr="Period_MN1"; break; default : TimeFrameStr="Current Timeframe"; } IndicatorShortName("Rounded ma MTF candles ("+TimeFrameStr+")"); return(0); } //---- //+------------------------------------------------------------------+ //| MTF function | //+------------------------------------------------------------------+ int start() { int counted_bars=IndicatorCounted(); if(counted_bars<0) return(-1); if(counted_bars>0) counted_bars--; int limit = MathMin(MathMax(Bars-counted_bars,3*timeFrame/Period()),Bars-1); for(int i=limit;i>=0;i--) { int y = iBarShift(NULL,timeFrame,Time); int slope=iCustom(Symbol(),timeFrame,"Rounded ma MTF",Length,Method,Round,Price,BarsToCalculate,5,y); if (slope == 1) { UpBuffer=High; DnBuffer=Low; UpbBuffer = MathMax(Open,Close); DnbBuffer = MathMin(Open,Close); } if (slope == -1) { DnBuffer=High; UpBuffer=Low; DnbBuffer = MathMax(Open,Close); UpbBuffer = MathMin(Open,Close); } } return(0); } //+------------------------------------------------------------------+ Coding help トレンド指標 マルチタイムフレーム・インディケーター Mladen Rakic 2015.05.21 21:57 #4757 thefxpros: こんにちは。icustom関数で丸めたマMTFローソク足インジケータを作ろうとしています。成功せず、エラーも全くありませんが、添付されたインジケータは何も表示されません。どうか助けてください。ありがとうございます。 ソースのインジケーターコードはこれです。 //+------------------------------------------------------------------+ //| MAR.mq4 | //| Copyright © 2014, Gehtsoft USA LLC | //| http://fxcodebase.com | //+------------------------------------------------------------------+ #property copyright "Copyright © 2014, Gehtsoft USA LLC" #property link "http://fxcodebase.com" #property indicator_chart_window #property indicator_buffers 3 #property indicator_color1 LimeGreen #property indicator_color2 Orange #property indicator_color3 Orange #property indicator_width1 2 #property indicator_width2 2 #property indicator_width3 2 extern int timeFrame = 0; // Time frame to use extern int Length=8; extern int Method=0; // 0 - SMA // 1 - EMA // 2 - SMMA // 3 - LWMA extern double Round=2; extern int Price=0; // Applied price // 0 - Close // 1 - Open // 2 - High // 3 - Low // 4 - Median // 5 - Typical // 6 - Weighted extern int BarsToCalculate = 0; double MAR[],MARda[],MARdb[],slope[] ; double MA[], MovAle[]; double MaRo; string indicatorFileName; bool returnBars; int init() { IndicatorShortName("Rounded ma MTF"); IndicatorBuffers(6); SetIndexBuffer(0,MAR); SetIndexBuffer(1,MARda); SetIndexBuffer(2,MARdb); SetIndexBuffer(3,MA); SetIndexBuffer(4,MovAle); SetIndexBuffer(5,slope); indicatorFileName = WindowExpertName(); returnBars = timeFrame==-999; if (returnBars) return(0); if (timeFrame==0) timeFrame= Period(); MaRo=Round*Point; return(0); } int deinit() { return(0); } int start() { int counted_bars=IndicatorCounted(); if(counted_bars<0) return(-1); if(counted_bars>0) counted_bars--; int limit = MathMin(Bars-counted_bars,Bars-1); if (returnBars) { MAR[0] = MathMin(limit+1,Bars-1); return(0); } if (timeFrame!=Period()) { limit = (int)MathMax(limit,MathMin(Bars-1,iCustom(NULL,timeFrame,indicatorFileName,-999,0,0)*timeFrame/Period())); if (BarsToCalculate>0) limit = MathMin(limit,BarsToCalculate); if (slope[limit]==-1) ClearPoint(limit,MARda,MARdb); for (int i=limit; i>=0; i--) { int y = iBarShift(NULL,timeFrame,Time); MAR = iCustom(NULL,timeFrame,indicatorFileName,0,Length,Method,Round,Price,BarsToCalculate,0,y); slope = iCustom(NULL,timeFrame,indicatorFileName,0,Length,Method,Round,Price,BarsToCalculate,5,y); MARda = EMPTY_VALUE; MARdb = EMPTY_VALUE; if (slope == -1) PlotPoint(i,MARda,MARdb,MAR); } return(0); } // // // // // if (BarsToCalculate>0) limit = MathMin(limit,BarsToCalculate); if (slope[limit]==-1) ClearPoint(limit,MARda,MARdb); for(int pos=limit; pos>=0; pos--) { MA[pos]=iMA(NULL, 0, Length, 0, Method, Price, pos); if (MA[pos]>MA[pos+1]+MaRo || MA[pos]MAR[pos+1]+MaRo || MA[pos]MAR[pos+1] && MovAle[pos+1]==1.) || (MA[pos]<MAR[pos+1] && MovAle[pos+1]==-1.)) MAR[pos]=MA[pos]; else MAR[pos]=MAR[pos+1]; if (MAR[pos]<MAR[pos+1]) MovAle[pos]=-1.; else if (MAR[pos]>MAR[pos+1]) MovAle[pos]=1.; else MovAle[pos]=MovAle[pos+1]; MARda[pos] = EMPTY_VALUE; MARdb[pos] = EMPTY_VALUE; slope[pos] = slope[pos+1]; if (MAR[pos]>MAR[pos+1]) slope[pos] = 1; if (MAR[pos]<MAR[pos+1]) slope[pos] = -1; if (slope[pos]==-1) PlotPoint(pos,MARda,MARdb,MAR); } return(0); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ // // // // // void ClearPoint(int i,double& first[],double& second[]) { if ((second != EMPTY_VALUE) && (second != EMPTY_VALUE)) second = EMPTY_VALUE; else if ((first != EMPTY_VALUE) && (first != EMPTY_VALUE) && (first == EMPTY_VALUE)) first = EMPTY_VALUE; } // // // // // void PlotPoint(int i,double& first[],double& second[],double& from[]) { if (first == EMPTY_VALUE) { if (first == EMPTY_VALUE) { first = from; first = from; second = EMPTY_VALUE; } else { second = from; second = from; first = EMPTY_VALUE; } } else { first = from; second = EMPTY_VALUE; } }[/CODE] and this is my indicator code: [CODE]//+------------------------------------------------------------------+ //| MAR.mq4 | //| Copyright © 2014, Gehtsoft USA LLC | //| http://fxcodebase.com | //+------------------------------------------------------------------+ #property copyright "Copyright © 2014, Gehtsoft USA LLC" #property link "http://fxcodebase.com" #property indicator_chart_window #property indicator_buffers 3 #property indicator_color1 LimeGreen #property indicator_color2 Orange #property indicator_color3 Orange #property indicator_width1 2 #property indicator_width2 2 #property indicator_width3 2 extern int timeFrame = 0; extern int Length = 8; extern int Method = 0; extern double Round = 2; extern int Price = 0; extern int BarsToCalculate = 0; extern color WickUpColor = DarkGreen; extern color WickDnColor = FireBrick; extern color BodyUpColor = LimeGreen; extern color BodyDnColor = Orange; extern int WickWidth = 1; extern int BodyWidth = 2; double UpBuffer[]; double DnBuffer[]; double UpbBuffer[]; double DnbBuffer[]; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int init() { SetIndexBuffer(0,UpBuffer); SetIndexStyle(0,DRAW_HISTOGRAM, EMPTY, WickWidth, WickUpColor); SetIndexBuffer(1,DnBuffer); SetIndexStyle(1,DRAW_HISTOGRAM, EMPTY, WickWidth, WickDnColor); SetIndexBuffer(2,UpbBuffer); SetIndexStyle(2,DRAW_HISTOGRAM, EMPTY, BodyWidth, BodyUpColor); SetIndexBuffer(3,DnbBuffer); SetIndexStyle(3,DRAW_HISTOGRAM, EMPTY, BodyWidth, BodyDnColor); IndicatorShortName("Rounded ma MTF candles ("+timeFrame+","+Length+","+Round+")"); Length = MathMax(Length,1); switch(timeFrame) { case 1 : string TimeFrameStr="Period_M1"; break; case 5 : TimeFrameStr="Period_M5"; break; case 15 : TimeFrameStr="Period_M15"; break; case 30 : TimeFrameStr="Period_M30"; break; case 60 : TimeFrameStr="Period_H1"; break; case 240 : TimeFrameStr="Period_H4"; break; case 1440 : TimeFrameStr="Period_D1"; break; case 10080 : TimeFrameStr="Period_W1"; break; case 43200 : TimeFrameStr="Period_MN1"; break; default : TimeFrameStr="Current Timeframe"; } IndicatorShortName("Rounded ma MTF candles ("+TimeFrameStr+")"); return(0); } //---- //+------------------------------------------------------------------+ //| MTF function | //+------------------------------------------------------------------+ int start() { int counted_bars=IndicatorCounted(); if(counted_bars<0) return(-1); if(counted_bars>0) counted_bars--; int limit = MathMin(MathMax(Bars-counted_bars,3*timeFrame/Period()),Bars-1); for(int i=limit;i>=0;i--) { int y = iBarShift(NULL,timeFrame,Time); int slope=iCustom(Symbol(),timeFrame,"Rounded ma MTF",Length,Method,Round,Price,BarsToCalculate,5,y); if (slope == 1) { UpBuffer=High; DnBuffer=Low; UpbBuffer = MathMax(Open,Close); DnbBuffer = MathMin(Open,Close); } if (slope == -1) { DnBuffer=High; UpBuffer=Low; DnbBuffer = MathMax(Open,Close); UpbBuffer = MathMin(Open,Close); } } return(0); } //+------------------------------------------------------------------+ 置き換える slope=iCustom(Symbol(),timeFrame, "Rounded ma MTF",Length,Method,Round,Price,BarsToCalculate,5,y); と slope=iCustom(Symbol(),timeFrame, "Rounded ma MTF",0,Length,Method,Round,Price,BarsToCalculate,5,y); zigflip 2015.05.22 00:33 #4758 mladen: これは、私がzup 150とgann sq9 mxi nmc indicatorを同じチャートに配置したときに得られるものです。 ありがとうございました。私のミスかもしれませんが、ポルチクのバージョンも入手しました。 心から Mladen Rakic 2015.05.22 16:20 #4759 zigflip: ありがとうございます、私のミスかもしれません。 何が起きたか教えてください。 多分、特定のメタトレーダーのビルドの問題です(私は現在ビルド788を使用しています)。 削除済み 2015.05.25 06:38 #4760 mladen: ご存知の通り、ZigZagはリペイントできますし、リペイントします。アラート(ポップアップ)を再計算するインジケーターのシグナルとして使うことは、非常に危険なことで、それがずっと前に私がアラートを作らないことに決めた理由です。私の知る限り、そのようなインジケーターのアラートは作らない方がよく、その後、なぜいくつかのアラートを追加するのか、なぜ再計算するインジケーターにシグナルが与えられるのかをよく知らない人々に説明しなければならないのでしょう。 よろしくお願いします ありがとうございました。ご回答ありがとうございます。 1...469470471472473474475476477478479480481482483...786 新しいコメント 取引の機会を逃しています。 無料取引アプリ 8千を超えるシグナルをコピー 金融ニュースで金融マーケットを探索 新規登録 ログイン スペースを含まないラテン文字 このメールにパスワードが送信されます エラーが発生しました Googleでログイン WebサイトポリシーおよびMQL5.COM利用規約に同意します。 新規登録 MQL5.com WebサイトへのログインにCookieの使用を許可します。 ログインするには、ブラウザで必要な設定を有効にしてください。 ログイン/パスワードをお忘れですか? Googleでログイン
こんにちは。
チャート上に固定テキストラベルを配置するためだけのインジケータが必要です。
モデルを見せていただけませんか?
ありがとうございます。
Jo
こんにちは。
チャート上に固定テキストラベルを配置するだけのインジケータが必要です。
モデルを見せていただけませんか?
ありがとうございます。
ジョウJo
あなたはこのスレッドをチェックしましたか?https://www.mql5.com/en/forum/179041
Jo このスレッドをチェックしましたか :https://www.mql5.com/en/forum/179041
Mladenです。
このスレッドの中で、まさに私が必要としている "TRO_MyNotes "をもたらすポストを発見しました。
もう一度、Mladen、あなたの助けのために多くの感謝を。
ジョウ
ただ、この件(投稿番号4739)について、どなたかお分かりになる方はいらっしゃいますか?
ありがとうございます。
このようなことが可能かどうかわかりませんが、添付のインジケータについて、チャネルに表示される黄色い線を「真」にすることは可能でしょうか?
これは、黄色い線が滑らかにならない/再計算されないという意味です。
ありがとうございます。ゴッドリッチ
それはできません。
これはHodrick/Prescottフィルターであり、その性質は再計算することです。そのような試みがなされてきましたが(たとえば、終点を尖らせる)、結果はオリジナルと似て非なるものです。
こんにちは。
私はicustom関数で 丸めたマMTFローソク足インジケータを作成しようとしています。成功せず、エラーも全くありませんが、添付のインジケータは何も表示されません。どうか助けてください。ありがとうございます。
ソースのインジケーターコードはこれです。
//| MAR.mq4 |
//| Copyright © 2014, Gehtsoft USA LLC |
//| http://fxcodebase.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2014, Gehtsoft USA LLC"
#property link "http://fxcodebase.com"
#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 LimeGreen
#property indicator_color2 Orange
#property indicator_color3 Orange
#property indicator_width1 2
#property indicator_width2 2
#property indicator_width3 2
extern int timeFrame = 0; // Time frame to use
extern int Length=8;
extern int Method=0; // 0 - SMA
// 1 - EMA
// 2 - SMMA
// 3 - LWMA
extern double Round=2;
extern int Price=0; // Applied price
// 0 - Close
// 1 - Open
// 2 - High
// 3 - Low
// 4 - Median
// 5 - Typical
// 6 - Weighted
extern int BarsToCalculate = 0;
double MAR[],MARda[],MARdb[],slope[] ;
double MA[], MovAle[];
double MaRo;
string indicatorFileName;
bool returnBars;
int init()
{
IndicatorShortName("Rounded ma MTF");
IndicatorBuffers(6);
SetIndexBuffer(0,MAR);
SetIndexBuffer(1,MARda);
SetIndexBuffer(2,MARdb);
SetIndexBuffer(3,MA);
SetIndexBuffer(4,MovAle);
SetIndexBuffer(5,slope);
indicatorFileName = WindowExpertName();
returnBars = timeFrame==-999; if (returnBars) return(0);
if (timeFrame==0) timeFrame= Period();
MaRo=Round*Point;
return(0);
}
int deinit()
{
return(0);
}
int start()
{
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
int limit = MathMin(Bars-counted_bars,Bars-1);
if (returnBars) { MAR[0] = MathMin(limit+1,Bars-1); return(0); }
if (timeFrame!=Period())
{
limit = (int)MathMax(limit,MathMin(Bars-1,iCustom(NULL,timeFrame,indicatorFileName,-999,0,0)*timeFrame/Period()));
if (BarsToCalculate>0) limit = MathMin(limit,BarsToCalculate);
if (slope[limit]==-1) ClearPoint(limit,MARda,MARdb);
for (int i=limit; i>=0; i--)
{
int y = iBarShift(NULL,timeFrame,Time);
MAR = iCustom(NULL,timeFrame,indicatorFileName,0,Length,Method,Round,Price,BarsToCalculate,0,y);
slope = iCustom(NULL,timeFrame,indicatorFileName,0,Length,Method,Round,Price,BarsToCalculate,5,y);
MARda = EMPTY_VALUE;
MARdb = EMPTY_VALUE;
if (slope == -1) PlotPoint(i,MARda,MARdb,MAR);
}
return(0);
}
//
//
//
//
//
if (BarsToCalculate>0) limit = MathMin(limit,BarsToCalculate);
if (slope[limit]==-1) ClearPoint(limit,MARda,MARdb);
for(int pos=limit; pos>=0; pos--)
{
MA[pos]=iMA(NULL, 0, Length, 0, Method, Price, pos);
if (MA[pos]>MA[pos+1]+MaRo || MA[pos]MAR[pos+1]+MaRo || MA[pos]MAR[pos+1] && MovAle[pos+1]==1.) || (MA[pos]<MAR[pos+1] && MovAle[pos+1]==-1.))
MAR[pos]=MA[pos];
else MAR[pos]=MAR[pos+1];
if (MAR[pos]<MAR[pos+1])
MovAle[pos]=-1.;
else
if (MAR[pos]>MAR[pos+1])
MovAle[pos]=1.;
else MovAle[pos]=MovAle[pos+1];
MARda[pos] = EMPTY_VALUE;
MARdb[pos] = EMPTY_VALUE;
slope[pos] = slope[pos+1];
if (MAR[pos]>MAR[pos+1]) slope[pos] = 1;
if (MAR[pos]<MAR[pos+1]) slope[pos] = -1;
if (slope[pos]==-1) PlotPoint(pos,MARda,MARdb,MAR);
}
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
//
//
//
//
//
void ClearPoint(int i,double& first[],double& second[])
{
if ((second != EMPTY_VALUE) && (second != EMPTY_VALUE))
second = EMPTY_VALUE;
else
if ((first != EMPTY_VALUE) && (first != EMPTY_VALUE) && (first == EMPTY_VALUE))
first = EMPTY_VALUE;
}
//
//
//
//
//
void PlotPoint(int i,double& first[],double& second[],double& from[])
{
if (first == EMPTY_VALUE)
{
if (first == EMPTY_VALUE) {
first = from;
first = from;
second = EMPTY_VALUE;
}
else {
second = from;
second = from;
first = EMPTY_VALUE;
}
}
else
{
first = from;
second = EMPTY_VALUE;
}
}[/CODE]
and this is my indicator code:
[CODE]//+------------------------------------------------------------------+
//| MAR.mq4 |
//| Copyright © 2014, Gehtsoft USA LLC |
//| http://fxcodebase.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2014, Gehtsoft USA LLC"
#property link "http://fxcodebase.com"
#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 LimeGreen
#property indicator_color2 Orange
#property indicator_color3 Orange
#property indicator_width1 2
#property indicator_width2 2
#property indicator_width3 2
extern int timeFrame = 0;
extern int Length = 8;
extern int Method = 0;
extern double Round = 2;
extern int Price = 0;
extern int BarsToCalculate = 0;
extern color WickUpColor = DarkGreen;
extern color WickDnColor = FireBrick;
extern color BodyUpColor = LimeGreen;
extern color BodyDnColor = Orange;
extern int WickWidth = 1;
extern int BodyWidth = 2;
double UpBuffer[];
double DnBuffer[];
double UpbBuffer[];
double DnbBuffer[];
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int init()
{
SetIndexBuffer(0,UpBuffer); SetIndexStyle(0,DRAW_HISTOGRAM, EMPTY, WickWidth, WickUpColor);
SetIndexBuffer(1,DnBuffer); SetIndexStyle(1,DRAW_HISTOGRAM, EMPTY, WickWidth, WickDnColor);
SetIndexBuffer(2,UpbBuffer); SetIndexStyle(2,DRAW_HISTOGRAM, EMPTY, BodyWidth, BodyUpColor);
SetIndexBuffer(3,DnbBuffer); SetIndexStyle(3,DRAW_HISTOGRAM, EMPTY, BodyWidth, BodyDnColor);
IndicatorShortName("Rounded ma MTF candles ("+timeFrame+","+Length+","+Round+")");
Length = MathMax(Length,1);
switch(timeFrame)
{
case 1 : string TimeFrameStr="Period_M1"; break;
case 5 : TimeFrameStr="Period_M5"; break;
case 15 : TimeFrameStr="Period_M15"; break;
case 30 : TimeFrameStr="Period_M30"; break;
case 60 : TimeFrameStr="Period_H1"; break;
case 240 : TimeFrameStr="Period_H4"; break;
case 1440 : TimeFrameStr="Period_D1"; break;
case 10080 : TimeFrameStr="Period_W1"; break;
case 43200 : TimeFrameStr="Period_MN1"; break;
default : TimeFrameStr="Current Timeframe";
}
IndicatorShortName("Rounded ma MTF candles ("+TimeFrameStr+")");
return(0);
}
//----
//+------------------------------------------------------------------+
//| MTF function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
int limit = MathMin(MathMax(Bars-counted_bars,3*timeFrame/Period()),Bars-1);
for(int i=limit;i>=0;i--)
{
int y = iBarShift(NULL,timeFrame,Time);
int slope=iCustom(Symbol(),timeFrame,"Rounded ma MTF",Length,Method,Round,Price,BarsToCalculate,5,y);
if (slope == 1) { UpBuffer=High; DnBuffer=Low; UpbBuffer = MathMax(Open,Close); DnbBuffer = MathMin(Open,Close); }
if (slope == -1) { DnBuffer=High; UpBuffer=Low; DnbBuffer = MathMax(Open,Close); UpbBuffer = MathMin(Open,Close); }
}
return(0);
}
//+------------------------------------------------------------------+
こんにちは。
icustom関数で丸めたマMTFローソク足インジケータを作ろうとしています。成功せず、エラーも全くありませんが、添付されたインジケータは何も表示されません。どうか助けてください。ありがとうございます。
ソースのインジケーターコードはこれです。
//| MAR.mq4 |
//| Copyright © 2014, Gehtsoft USA LLC |
//| http://fxcodebase.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2014, Gehtsoft USA LLC"
#property link "http://fxcodebase.com"
#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 LimeGreen
#property indicator_color2 Orange
#property indicator_color3 Orange
#property indicator_width1 2
#property indicator_width2 2
#property indicator_width3 2
extern int timeFrame = 0; // Time frame to use
extern int Length=8;
extern int Method=0; // 0 - SMA
// 1 - EMA
// 2 - SMMA
// 3 - LWMA
extern double Round=2;
extern int Price=0; // Applied price
// 0 - Close
// 1 - Open
// 2 - High
// 3 - Low
// 4 - Median
// 5 - Typical
// 6 - Weighted
extern int BarsToCalculate = 0;
double MAR[],MARda[],MARdb[],slope[] ;
double MA[], MovAle[];
double MaRo;
string indicatorFileName;
bool returnBars;
int init()
{
IndicatorShortName("Rounded ma MTF");
IndicatorBuffers(6);
SetIndexBuffer(0,MAR);
SetIndexBuffer(1,MARda);
SetIndexBuffer(2,MARdb);
SetIndexBuffer(3,MA);
SetIndexBuffer(4,MovAle);
SetIndexBuffer(5,slope);
indicatorFileName = WindowExpertName();
returnBars = timeFrame==-999; if (returnBars) return(0);
if (timeFrame==0) timeFrame= Period();
MaRo=Round*Point;
return(0);
}
int deinit()
{
return(0);
}
int start()
{
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
int limit = MathMin(Bars-counted_bars,Bars-1);
if (returnBars) { MAR[0] = MathMin(limit+1,Bars-1); return(0); }
if (timeFrame!=Period())
{
limit = (int)MathMax(limit,MathMin(Bars-1,iCustom(NULL,timeFrame,indicatorFileName,-999,0,0)*timeFrame/Period()));
if (BarsToCalculate>0) limit = MathMin(limit,BarsToCalculate);
if (slope[limit]==-1) ClearPoint(limit,MARda,MARdb);
for (int i=limit; i>=0; i--)
{
int y = iBarShift(NULL,timeFrame,Time);
MAR = iCustom(NULL,timeFrame,indicatorFileName,0,Length,Method,Round,Price,BarsToCalculate,0,y);
slope = iCustom(NULL,timeFrame,indicatorFileName,0,Length,Method,Round,Price,BarsToCalculate,5,y);
MARda = EMPTY_VALUE;
MARdb = EMPTY_VALUE;
if (slope == -1) PlotPoint(i,MARda,MARdb,MAR);
}
return(0);
}
//
//
//
//
//
if (BarsToCalculate>0) limit = MathMin(limit,BarsToCalculate);
if (slope[limit]==-1) ClearPoint(limit,MARda,MARdb);
for(int pos=limit; pos>=0; pos--)
{
MA[pos]=iMA(NULL, 0, Length, 0, Method, Price, pos);
if (MA[pos]>MA[pos+1]+MaRo || MA[pos]MAR[pos+1]+MaRo || MA[pos]MAR[pos+1] && MovAle[pos+1]==1.) || (MA[pos]<MAR[pos+1] && MovAle[pos+1]==-1.))
MAR[pos]=MA[pos];
else MAR[pos]=MAR[pos+1];
if (MAR[pos]<MAR[pos+1])
MovAle[pos]=-1.;
else
if (MAR[pos]>MAR[pos+1])
MovAle[pos]=1.;
else MovAle[pos]=MovAle[pos+1];
MARda[pos] = EMPTY_VALUE;
MARdb[pos] = EMPTY_VALUE;
slope[pos] = slope[pos+1];
if (MAR[pos]>MAR[pos+1]) slope[pos] = 1;
if (MAR[pos]<MAR[pos+1]) slope[pos] = -1;
if (slope[pos]==-1) PlotPoint(pos,MARda,MARdb,MAR);
}
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
//
//
//
//
//
void ClearPoint(int i,double& first[],double& second[])
{
if ((second != EMPTY_VALUE) && (second != EMPTY_VALUE))
second = EMPTY_VALUE;
else
if ((first != EMPTY_VALUE) && (first != EMPTY_VALUE) && (first == EMPTY_VALUE))
first = EMPTY_VALUE;
}
//
//
//
//
//
void PlotPoint(int i,double& first[],double& second[],double& from[])
{
if (first == EMPTY_VALUE)
{
if (first == EMPTY_VALUE) {
first = from;
first = from;
second = EMPTY_VALUE;
}
else {
second = from;
second = from;
first = EMPTY_VALUE;
}
}
else
{
first = from;
second = EMPTY_VALUE;
}
}[/CODE]
and this is my indicator code:
[CODE]//+------------------------------------------------------------------+
//| MAR.mq4 |
//| Copyright © 2014, Gehtsoft USA LLC |
//| http://fxcodebase.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2014, Gehtsoft USA LLC"
#property link "http://fxcodebase.com"
#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 LimeGreen
#property indicator_color2 Orange
#property indicator_color3 Orange
#property indicator_width1 2
#property indicator_width2 2
#property indicator_width3 2
extern int timeFrame = 0;
extern int Length = 8;
extern int Method = 0;
extern double Round = 2;
extern int Price = 0;
extern int BarsToCalculate = 0;
extern color WickUpColor = DarkGreen;
extern color WickDnColor = FireBrick;
extern color BodyUpColor = LimeGreen;
extern color BodyDnColor = Orange;
extern int WickWidth = 1;
extern int BodyWidth = 2;
double UpBuffer[];
double DnBuffer[];
double UpbBuffer[];
double DnbBuffer[];
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int init()
{
SetIndexBuffer(0,UpBuffer); SetIndexStyle(0,DRAW_HISTOGRAM, EMPTY, WickWidth, WickUpColor);
SetIndexBuffer(1,DnBuffer); SetIndexStyle(1,DRAW_HISTOGRAM, EMPTY, WickWidth, WickDnColor);
SetIndexBuffer(2,UpbBuffer); SetIndexStyle(2,DRAW_HISTOGRAM, EMPTY, BodyWidth, BodyUpColor);
SetIndexBuffer(3,DnbBuffer); SetIndexStyle(3,DRAW_HISTOGRAM, EMPTY, BodyWidth, BodyDnColor);
IndicatorShortName("Rounded ma MTF candles ("+timeFrame+","+Length+","+Round+")");
Length = MathMax(Length,1);
switch(timeFrame)
{
case 1 : string TimeFrameStr="Period_M1"; break;
case 5 : TimeFrameStr="Period_M5"; break;
case 15 : TimeFrameStr="Period_M15"; break;
case 30 : TimeFrameStr="Period_M30"; break;
case 60 : TimeFrameStr="Period_H1"; break;
case 240 : TimeFrameStr="Period_H4"; break;
case 1440 : TimeFrameStr="Period_D1"; break;
case 10080 : TimeFrameStr="Period_W1"; break;
case 43200 : TimeFrameStr="Period_MN1"; break;
default : TimeFrameStr="Current Timeframe";
}
IndicatorShortName("Rounded ma MTF candles ("+TimeFrameStr+")");
return(0);
}
//----
//+------------------------------------------------------------------+
//| MTF function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
int limit = MathMin(MathMax(Bars-counted_bars,3*timeFrame/Period()),Bars-1);
for(int i=limit;i>=0;i--)
{
int y = iBarShift(NULL,timeFrame,Time);
int slope=iCustom(Symbol(),timeFrame,"Rounded ma MTF",Length,Method,Round,Price,BarsToCalculate,5,y);
if (slope == 1) { UpBuffer=High; DnBuffer=Low; UpbBuffer = MathMax(Open,Close); DnbBuffer = MathMin(Open,Close); }
if (slope == -1) { DnBuffer=High; UpBuffer=Low; DnbBuffer = MathMax(Open,Close); UpbBuffer = MathMin(Open,Close); }
}
return(0);
}
//+------------------------------------------------------------------+
置き換える
slope=iCustom(Symbol(),timeFrame, "Rounded ma MTF",Length,Method,Round,Price,BarsToCalculate,5,y);
と
slope=iCustom(Symbol(),timeFrame, "Rounded ma MTF",0,Length,Method,Round,Price,BarsToCalculate,5,y);
これは、私がzup 150とgann sq9 mxi nmc indicatorを同じチャートに配置したときに得られるものです。
ありがとうございました。私のミスかもしれませんが、ポルチクのバージョンも入手しました。
心から
ありがとうございます、私のミスかもしれません。
何が起きたか教えてください。
多分、特定のメタトレーダーのビルドの問題です(私は現在ビルド788を使用しています)。
ご存知の通り、ZigZagはリペイントできますし、リペイントします。
アラート(ポップアップ)を再計算するインジケーターのシグナルとして使うことは、非常に危険なことで、それがずっと前に私がアラートを作らないことに決めた理由です。私の知る限り、そのようなインジケーターのアラートは作らない方がよく、その後、なぜいくつかのアラートを追加するのか、なぜ再計算するインジケーターにシグナルが与えられるのかをよく知らない人々に説明しなければならないのでしょう。
よろしくお願いしますありがとうございました。ご回答ありがとうございます。