//+------------------------------------------------------------------+ //| YaannaSignal.mq4 | //| Copyright © 2009, Victor Chebotariov | //+----[ ICQ ]-------------------------------------------------------+ //| 342-574-15 | //+----[ Phone ]-----------------------------------------------------+ //| +380958965042 | //| +380652707069 | //| +380443609960 | //+----[ Web ]-------------------------------------------------------+ //| http://chebotariov.com | //| http://chebotariov.co.ua | //| http://amero.com.ua | //| http://amero.co.ua | //| http://investmoney.kiev.ua | //| http://riskinvest.kiev.ua | //| http://tetrabourse.com.ua | //| http://tb-unitrade.com.ua | //| http://i-contact.kiev.ua | //| http://srubidom.com | //+----[ E-mail ]----------------------------------------------------+ //| victor@chebotariov.co.ua | //+------------------------------------------------------------------+ #property copyright "Copyright © 2009, Victor Chebotariov" #property link "http://www.chebotariov.com" #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Blue #property indicator_color2 Red //---- input parameters extern int BBPeriod=200; extern int BuyStop=40; extern int SellStop=60; //---- buffers double ExtMapBuffer1[]; double ExtMapBuffer2[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0,DRAW_ARROW); SetIndexBuffer(0,ExtMapBuffer1); SetIndexStyle(1,DRAW_ARROW); SetIndexBuffer(1,ExtMapBuffer2); //---- return(0); } //+------------------------------------------------------------------+ //| YaannaSignal | //+------------------------------------------------------------------+ int start() { //---- int counted_bars = IndicatorCounted(); if(counted_bars < 0) return(-1); if(counted_bars > 0) counted_bars--; int i = Bars - counted_bars; i-=4; while(i>=0) { string name = BBPeriod+"_"+BuyStop+"_"+SellStop+"_"+Symbol()+Period(); double highbb = iBands(NULL,0,BBPeriod,2,0,PRICE_LOW,MODE_UPPER,i); double lowbb = iBands(NULL,0,BBPeriod,2,0,PRICE_LOW,MODE_LOWER,i); double close = Close[i]; double ma = iMA(NULL,0,BBPeriod,0,0,0,i); double visota = (highbb-lowbb); // высота == 100% if(visota==0){visota=1;} double pclose = (close-lowbb); // цена double enter = pclose/visota*100; double vLow=Low[iLowest(NULL,0,MODE_LOW,10,i+3)]; double vHigh=High[iHighest(NULL,0,MODE_HIGH,10,i+3)]; double buy = GlobalVariableGet(name+"_buy"); double sell = GlobalVariableGet(name+"_sell"); if(enter<0 && buy==0){GlobalVariableSet(name+"_buy",Close[i]);} if(enter>=BuyStop){GlobalVariableSet(name+"_buy",0);} if(enter>100 && sell==0){GlobalVariableSet(name+"_sell",Close[i]);} if(enter<=SellStop){GlobalVariableSet(name+"_sell",0);} if(buy!=0) { ExtMapBuffer1[i]=buy; Comment("Поздно продавать, дождитесь коррекции"); } else if(sell!=0) { ExtMapBuffer2[i]=sell; Comment("Поздно покупать, дождитесь коррекции"); } else { Comment("---"); } i--; } //---- return(0); } //+------------------------------------------------------------------+