//+------------------------------------------------------------------+ //| Volume_RSI_Arrows_MACD_Combined_with_DailyOpen.mq4 | //+------------------------------------------------------------------+ #property indicator_chart_window #property indicator_buffers 7 #property indicator_color1 Lime // Alış oku (YEŞİL) #property indicator_color2 Red // Satış oku (KIRMIZI) #property indicator_color3 Gold // RSI çizgisi #property indicator_color4 Silver // MACD Histogram #property indicator_color5 Red // MACD Signal #property indicator_color6 White // Daily Open Line #property indicator_width1 3 #property indicator_width2 3 #property indicator_width4 2 #property indicator_style6 2 #property indicator_width6 1 extern int bars = 10000; //---- RSI Ayarları input int RSIPeriod = 14; // RSI Periyodu double RSIBuffer[]; //---- Volume Ok Buffers double BuyArrow[], SellArrow[]; //---- MACD Ayarları input int FastEMA = 12; // Fast EMA Period input int SlowEMA = 26; // Slow EMA Period input int SignalSMA = 9; // Signal SMA Period double MacdBuffer[], SignalBuffer[], HistogramBuffer[]; //---- Daily Open Line Settings double TodayOpenBuffer[]; input int TimeZoneOfData = 0; // Timezone offset for daily open //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- Volume Okları Ayarları SetIndexBuffer(0, BuyArrow); SetIndexStyle(0, DRAW_ARROW); SetIndexArrow(0, 233); SetIndexBuffer(1, SellArrow); SetIndexStyle(1, DRAW_ARROW); SetIndexArrow(1, 234); //---- RSI Buffer Ayarları SetIndexBuffer(2, RSIBuffer); SetIndexStyle(2, DRAW_LINE); SetIndexLabel(2, "RSI"); //---- MACD Buffer Ayarları SetIndexBuffer(3, MacdBuffer); SetIndexStyle(3, DRAW_HISTOGRAM); SetIndexLabel(3, "MACD"); SetIndexBuffer(4, SignalBuffer); SetIndexStyle(4, DRAW_LINE); SetIndexLabel(4, "Signal"); SetIndexBuffer(5, HistogramBuffer); SetIndexStyle(5, DRAW_NONE); // Görselleştirme için kullanılmıyor //---- Daily Open Line Buffer SetIndexBuffer(6, TodayOpenBuffer); SetIndexStyle(6, DRAW_LINE); SetIndexLabel(6, "Daily Open"); IndicatorShortName("RSI_MACD_DailyOpen("+IntegerToString(FastEMA)+","+IntegerToString(SlowEMA)+","+IntegerToString(SignalSMA)+")"); return(0); } //+------------------------------------------------------------------+ //| Daily Open Calculation Function | //+------------------------------------------------------------------+ void CalculateDailyOpen() { int counted_bars = IndicatorCounted(); if (counted_bars > 0) counted_bars--; int lastbar = Bars - counted_bars; if (lastbar > bars) lastbar = bars; int tzdiffsec = TimeZoneOfData * 3600; double barsper30 = 1.0*PERIOD_M30/Period(); lastbar = MathMin(Bars-20*barsper30-1, lastbar); for(int shift=lastbar; shift>=0; shift--) { TodayOpenBuffer[shift] = 0; if(TimeDay(Time[shift]-tzdiffsec) != TimeDay(Time[shift+1]-tzdiffsec)) // day change { TodayOpenBuffer[shift] = Open[shift]; TodayOpenBuffer[shift+1] = 0; // avoid stairs in the line } else { TodayOpenBuffer[shift] = TodayOpenBuffer[shift+1]; } } } //+------------------------------------------------------------------+ //| RSI Hesaplama Fonksiyonu | //+------------------------------------------------------------------+ double CalculateRSI(int shift) { double U, D; if(shift > Bars - RSIPeriod) return(50); // Yeterli veri yoksa U = 0; D = 0; for(int i=shift; i 0) U += diff; else D += MathAbs(diff); } double RS = (D == 0) ? 100 : U/D; return(100 - (100 / (1 + RS))); } //+------------------------------------------------------------------+ //| MACD Hesaplama Fonksiyonu | //+------------------------------------------------------------------+ void CalculateMACD() { int limit = Bars - IndicatorCounted(); if(limit > Bars-2) limit = Bars-2; if (limit > bars) limit = bars; for(int i = limit; i >= 0; i--) { MacdBuffer[i] = iMA(NULL, 0, FastEMA, 0, MODE_EMA, PRICE_CLOSE, i) - iMA(NULL, 0, SlowEMA, 0, MODE_EMA, PRICE_CLOSE, i); SignalBuffer[i] = iMAOnArray(MacdBuffer, Bars, SignalSMA, 0, MODE_SMA, i); HistogramBuffer[i] = MacdBuffer[i] - SignalBuffer[i]; } } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int limit = Bars - IndicatorCounted(); if(limit > Bars-2) limit = Bars-2; if (limit > bars) limit = bars; //---- RSI Hesapla for(int i=limit; i>=0; i--) RSIBuffer[i] = CalculateRSI(i); //---- MACD Hesapla CalculateMACD(); //---- Daily Open Hesapla CalculateDailyOpen(); //---- Sinyal Kontrolleri for(i=limit-1; i>=0; i--) { bool currentGreen = (Close[i] > Close[i+1]); bool prevGreen = (Close[i+1] > Close[i+2]); bool currentRed = (Close[i] < Close[i+1]); bool prevRed = (Close[i+1] < Close[i+2]); double rsi = RSIBuffer[i]; double macd = MacdBuffer[i]; double histogram = HistogramBuffer[i]; double dailyOpen = TodayOpenBuffer[i]; //---- Alış Sinyali: 2 Yeşil + Hacim Artışı + RSI > 50 + MACD > 0 ve Histogram > Signal + Fiyat > Daily Open if(currentGreen && prevGreen && Volume[i] > Volume[i+1] && rsi > 50 && macd > 0 && histogram > 0 && Close[i] > dailyOpen) { BuyArrow[i] = Low[i] - 500*Point; // 500 pip aşağı SellArrow[i] = EMPTY_VALUE; } //---- Satış Sinyali: 2 Kırmızı + Hacim Artışı + RSI < 50 + MACD < 0 ve Histogram < Signal + Fiyat < Daily Open else if(currentRed && prevRed && Volume[i] > Volume[i+1] && rsi < 50 && macd < 0 && histogram < 0 && Close[i] < dailyOpen) { SellArrow[i] = High[i] + 500*Point; // 500 pip yukarı BuyArrow[i] = EMPTY_VALUE; } else { BuyArrow[i] = EMPTY_VALUE; SellArrow[i] = EMPTY_VALUE; } } return(0); } //+------------------------------------------------------------------+