怠慢は、進歩またはグラフィックスとインタラクティブに作業する方法への刺激
はじめに
英語を話すフォーラムで、フィボナッチレベル解釈の面白い記述に出会いました。主要な考えは 38,2 と 61,8 % の領域に近づくインパルス移動の修正です。そこにアップロードされたビデオを見て、自分でチャートにフィボナッチレベルを描画しようとして、私は自分の実線でこのツールを利用するようになりました。
私はこのシステムの利点や欠点をを検証することはしません。ここでお話したいのは別のことです。私は自然に怠け者で(私独りではないと思います)、チャート上で反転ゾーンを検索する fib を際限なく描画することは十分退屈であるため、作業の一部を MQL4 に入れることにしました。
解決すべき主な問題は、価格チャート上にゾーンをなんらかの色付きで手描画の fib を自動で表示することです。オブジェクトを色表示することで、それをより明確に理解できるようになる、というのは周知のことです。つねにチャート上で指定される数字を伴う多様なラインを分析するよりもオブジェクトを認識する方がずっと簡単であることには同意します。
グラフィカルオブジェクトの座標処理
私は当然のように双方向性はチャート作業中にもたらされるべきであると考えます。アイコンや、もっと他にもトレーダーによって作成される絵図に対するグラフィカルな図を描画するプログラムを取得する必要があり、また、たとえばトレンドラインが交差するときの添付音も必要です。
マニュアル描画のメリットに注意が必要です。
- これにより、トレーダーはチャート上に描かれるオブジェクトの参照ポイントを割り当てることができるのです。
- 十分なコード入力やコンピュータのプロセッサの負荷が省かれます。
- チャート上にオブジェクトを描画する初期ロジックをプログラムする必要はありません。ところで、プログラムで必要なロジックに到達するのはそれほど簡単ではありません。たとえば、いつくの"ZigZag" インディケータがそこにあるか見てください。
こでは、手描きのトレンドラインの交点のインディケータを実装する方法を説明したいと思います。
まず、チャートにトレンドラインを描きます。それからこのラインをオブジェクトリストで見つけます。このラインはたとえば Trendline 29344 という名前がついています。トレンドラインはライン自体の説明で、29344 は MetaTrader 4 クライアントターミナルによってそこに割り当てられた数字です。
Trendline の名前を TrDup とつけ直します。それは上昇トレンドのラインとなります。
それから、別のトレンドラインを作成する同じステップを繰り返し、下落トレンドを占めるトレンドライン TrDdown を作成します。
(1_01_Tr_Alert インディケータはまさにこういったラインと連携して調整され、TL_by_Demark_v6 を描くトレンドライン Demark のインディケータで同一名が使用されます。)
そうして、MQL4 によってチャート上のオブジェクト数を読む必要があります。
int obj_total=ObjectsTotal();
obj_total 変数のチャート上でオブジェクト数を取得します。
オブジェクト数を取得したところで、アルゴリズムのさらなる処理を継続するために必要な一つを選択することが残されています。それを行うには、サイクルの一般的演算子を使って、オブジェクト "TrDup" および "TrDdown" を見つけ出します。
// Determine the Trend line object int obj_total=ObjectsTotal(); string index; for(int i=0;i<obj_total;i++) { index=ObjectName(i); string substrTL_down = StringSubstr (index, 0, 7); if (substrTL_down == "TrDdown") string TrDLine_down=index; string substrTL_up = StringSubstr (index, 0, 5); if (substrTL_up == "TrDup") string TrDLine_up=index; }
それから、その名前を文字列変数TrDLine_down と TrDLine_up に割り当てます。
これで、マニュアルでチャートに描いた特定のトレンドラインを取得しました。ここから始めて、インディケータはラインの座標を固定し、必要なアルゴリズムによってそれらを用いてアクションの一部を行うことができます。
2番目のバーのクローズの下のろうそく足の1番目のバーのクローズシグナルを取得する必要があります。トレンドラインがこれら2本バーの間にあると仮定して。そのように価格ごとにトレンドラインを交差するシグナルを受け取ります。
if ((Close[1]>ObjectGetValueByShift(TrDLine, 1)) && (Close[2]<ObjectGetValueByShift(TrDLine, 2)))
これで、アラートと音声メディアファイルを実行すること、またはたとえばトレンドラインが交差するバー付近にチャート上で矢印を描く必要があるだけです。
この方法で、簡単にチャートにマニュアルで追加される任意のオブジェクトとのインタラクティブな連携を作成することができるのです。フィボナッチレベル、チャンネル、その他
オニキス・フォーラムで公開されるフィボナッチレベルのカラーゾーンを表示するインディケータが一例としての機能を果たします。:http://www.onix-trade.net/forum/index.php?act=attach&type=post&id=27033&setlanguage=1&langid=ru
次は、最終波によるフィボナッチレベルの自動描画に対するZigZag インディケータでの補足です。:http://www.onix-trade.net/forum/index.php?act=attach&type=post&id=27175&setlanguage=1&langid=ru
以下に、チャートに入っている『価格レベル』オブジェクトを用いた、フィボ ゾーンの複雑な表示、トレンドライン交差表示、チャート上の現行価格表示に対するインディケータのコードを提供しています。
//+------------------------------------------------------------------+ //| 1.012_InfoFibo.mq4 | //| | //| b2w@narod.ru | //+------------------------------------------------------------------+ #property copyright "http://www.fibook.ru" #property link "b2w@narod.ru" #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Lime #property indicator_color2 Red //---- input parameters extern bool Auto_Correct_Line = false;// Autocorrection of the last Fibo point extern bool ClearRectangle = true;//Deleting of the squares while redrawing of the Fibo levels extern bool TargetZone = true;//Drawing of the target zones extern int count_Alert=3; //the number of iterations of Alert double fibs[] = {-0.618, -0.382, -0.237, 0.0, 0.145, 0.382, 0.618, 0.855, 1.0, 1.237, 1.382, 1.618}; color fibsColor[] = {Maroon, Green, ForestGreen, Teal, SteelBlue, , SteelBlue, Teal, ForestGreen, Green, Maroon}; double Old_Price; color FontColor=Black; string TextAlert[7]; int y=0,count_a=0; double ftime; double win_idx; string NameFibs; double Spread; double ExtMapBufferUP[]; double ExtMapBufferDN[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { Spread=(Ask-Bid); //---- indicators SetIndexStyle(0,DRAW_ARROW,0,1); SetIndexArrow(0,233); SetIndexBuffer(0,ExtMapBufferUP); SetIndexEmptyValue(0,0.0); SetIndexStyle(1,DRAW_ARROW,0,1); SetIndexArrow(1,234); SetIndexBuffer(1,ExtMapBufferDN); SetIndexEmptyValue(1,0.0); return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { if(ftime!=Time[0]) count_a=0; // int counted_bars=IndicatorCounted(); //---- // Determine if there are the Fibo levels or not int obj_total=ObjectsTotal(); string index; for(int i=0;i<obj_total;i++) { index=ObjectName(i); string substr = StringSubstr(index, 0, 4); if (substr == "Fibo") NameFibs=index; string substrTL = StringSubstr (index, 0, 9); if (substrTL == "Trendline") string TrDLine=index; string substrPR = StringSubstr (index, 0, 5); if (substrPR == "Arrow") string PR=index; } // Paramaters of the trend line if (StringLen(TrDLine)>1) { if (ObjectGet(TrDLine, OBJPROP_PRICE1)>ObjectGet(TrDLine, OBJPROP_PRICE2)) { if ((Close[1]>ObjectGetValueByShift(TrDLine, 1)) && (Close[2]<ObjectGetValueByShift(TrDLine, 2))) { ExtMapBufferUP[1]=(Low[1]-5*Point); /*Alert (Symbol()," Trend UP enter");*/ c_alert(1); } } else if (ObjectGet(TrDLine, OBJPROP_PRICE1)<ObjectGet(TrDLine, OBJPROP_PRICE2)) { if ((Close[1]<ObjectGetValueByShift(TrDLine, 1)) && (Close[2]>ObjectGetValueByShift(TrDLine, 2))) { ExtMapBufferDN[1]=(High[1]+5*Point);/*Alert (Symbol()," Trend DN enter");*/ c_alert(1); } } } // The end of calculation of the trend line if (StringLen(NameFibs) <1) return(-1);// If there are no Fibo levels, then we exit // Determine where the Fibo levels are drawn double pr1=ObjectGet(NameFibs, OBJPROP_PRICE1);// first price High double pr1vrem=ObjectGet(NameFibs, OBJPROP_TIME1);// first time of the price double pr2=ObjectGet(NameFibs,OBJPROP_PRICE2);// second price Low double pr2vrem=ObjectGet(NameFibs, OBJPROP_TIME2);// second time of the price double fibprop=(pr1-pr2);// The difference between HIGH and LOW double Timeend=(Time[0]+(Period()*360)); // The right side by the time // to display the objects on the chart double TimeNachalo=(Time[0]+Period()*60);// The right side by the time // to display the objects on the chart //+++ ObjectMove(PR, 0,Time[0], Bid);// The icon of the current price //+++ // Parameters of the rectangle of the reverse zone.. double verx=(pr1-fibprop*0.382); double niz=(pr2+fibprop*0.382); string UP=DoubleToStr(verx+Spread,Digits); string DN=DoubleToStr(niz-Spread,Digits); if (Auto_Correct_Line==true) { if (High[0]>pr1) ObjectMove(NameFibs, 0,Time[0], High[0]); if (Low[0]<pr2) ObjectMove(NameFibs, 1,Time[0], Low[0]); } if (ClearRectangle == true) ObjectsDeleteAll(0,OBJ_RECTANGLE);// Delete the RECTANGLES objects // Draw the rectangles in the cycle for( y=0;y<11;y++) { ObjectCreate(("Kvadrat"+y), OBJ_RECTANGLE, 0, TimeNachalo,(pr2+fibprop*fibs[y]), Timeend,(pr2+fibprop*fibs[y+1]) ); ObjectSet(("Kvadrat"+y),OBJPROP_COLOR,fibsColor[y]); } // The end of drawing /* Drawing of the rectangle of the ZONE */ ObjectCreate("Kvadrat", OBJ_RECTANGLE, 0, TimeNachalo, verx , Timeend , niz); ObjectSet("Kvadrat",OBJPROP_BACK,false); // The array of text data TextAlert[0] = "Attention two targets "; TextAlert[1] = ("Order up * "+UP); TextAlert[2] = ("Order down * "+DN); TextAlert[3] = ("TARGET up 2 * "+(DoubleToStr(pr1+fibprop*0.618,Digits))); TextAlert[4] = ("TARGET up 1 * "+(DoubleToStr(pr1+fibprop*0.382,Digits))); TextAlert[5] = ("TARGET down 1 * "+(DoubleToStr(pr2-fibprop*0.382,Digits))); TextAlert[6] = ("TARGET down 2 * "+(DoubleToStr(pr2-fibprop*0.618,Digits))); double YDist[] = {20, 55, 80, 120, 150, 180, 210}; color TextAlertClr[] = {Yellow, Green, Red, Green, Green, Red, Red}; // Output to the screen the message about orders entering for(y=0;y<7;y++) ObjectDelete("TextAlerts"+y); if (TargetZone == true) { if (Bid > niz && Bid < verx) for(y=0;y<7;y++) { ObjectCreate(("TextAlerts"+y), OBJ_LABEL, 0, 0, 0); ObjectSetText(("TextAlerts"+y),TextAlert[y], 12, "Times New Roman",TextAlertClr[y]); ObjectSet(("TextAlerts"+y), OBJPROP_CORNER, 0); ObjectSet(("TextAlerts"+y), OBJPROP_XDISTANCE, 10); ObjectSet(("TextAlerts"+y), OBJPROP_YDISTANCE, YDist[y]); } } // The informer of the price and the currency name ObjectDelete("Market_Price_Label101"); ObjectCreate("Market_Text_Label101", OBJ_LABEL, 0, 0, 0); ObjectSetText("Market_Text_Label101", (Symbol()+" "+Period()), 16, "Times New Roman", Yellow); ObjectSet("Market_Text_Label101", OBJPROP_CORNER, 2); ObjectSet("Market_Text_Label101", OBJPROP_XDISTANCE, 5); ObjectSet("Market_Text_Label101", OBJPROP_YDISTANCE, 5); return(0); } //+------------------------------------------------------------------+ void c_alert(int w) { ftime=Time[0]; if(count_a<count_Alert) {count_a+=1; PlaySound("ku_ku.wav"); } } return;
次の画像には、GBPUSD の時間チャート上のトレンドラインの交差が示されています。
おわりに
受け取られたデータ処理に対してこの方法を適用することは、トレーダーの作業にとても役立ちます。目を解放してポジションをアクティブにあうるかクローズする必要な瞬間を常に待つことから解き放つことは、感情的ストレスを軽減するだけでなく、トレーディングでの必要な瞬間を逃すことも減ります。
そして、みなさんにとって物事をすべて簡単にするのに、\templates\ フォルダに入れる GBP チャートのテンプレートを添付しています。
インディケータ自体は \experts\indicators\ フォルダにあります。
音声ファイルは \sounds\ フォルダに入れる必要があります。
MetaQuotes Ltdによってロシア語から翻訳されました。
元の記事: https://www.mql5.com/ru/articles/1546
- 無料取引アプリ
- 8千を超えるシグナルをコピー
- 金融ニュースで金融マーケットを探索