Cross MA-RSI

MQL4 Script

Lavoro terminato

Tempo di esecuzione 16 ore
Feedback del cliente
Programmer motion helpful and professional. Recommended!!

Specifiche

Hi, I need to correct this code. When the MA3 crosses the RSI2 from the bottom up, it must appear to the arrow. I wrote this code but it does not work. Thanks, Max.


#property indicator_chart_window
#property indicator_buffers 1

#property indicator_type1 DRAW_ARROW
#property indicator_width1 1
#property indicator_color1 clrGreen
#property indicator_label1 "Buy"

input int Period_RSI=2;
input int Period_MA=3;

//--- indicator buffers
double Buffer1[];


//+------------------------------------------------------------------+
//|                    |
//+------------------------------------------------------------------+
int OnInit()
  {   
   IndicatorBuffers(2);
   SetIndexBuffer(0, Buffer1);
   SetIndexEmptyValue(0, 0);
   SetIndexArrow(0, 241);
   
  
   return(INIT_SUCCEEDED);
  }

//+------------------------------------------------------------------+
//|                          |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime& time[],
                const double& open[],
                const double& high[],
                const double& low[],
                const double& close[],
                const long& tick_volume[],
                const long& volume[],
                const int& spread[])
  {
  double RSI[];
  double MA[];
  RSI[0]= iRSI(NULL,PERIOD_CURRENT,Period_RSI,PRICE_CLOSE,0);
  MA[0]= iMA(NULL,PERIOD_CURRENT,Period_MA,0,MODE_SMA,PRICE_CLOSE,0);
  
   int limit = rates_total - prev_calculated;
   //--- counting from 0 to rates_total
   ArraySetAsSeries(Buffer1, true);
   
   //--- initial zero
   if(prev_calculated < 1)
     {
      ArrayInitialize(Buffer1, 0);
      
     }
   else
      limit++;
   
   //--- main loop
   for(int i = limit-1; i >= 0; i--)
     {
      if (i >= MathMin(300-1, rates_total-1-50)) continue; 
      //Indicator Buffer 1
      if (iMAOnArray(RSI,0,Period_MA,0,0,1)< iRSIOnArray(MA,0,Period_RSI,0)//Cross MA-RSI
      && iMAOnArray(RSI,0,Period_MA,0,0,0)>iRSIOnArray(MA,0,Period_RSI,0)
      
      )
        {
         Buffer1[i] = Low[i] - 10 *Point();
        }
      else
        {
         Buffer1[i] = 0;
        }
     
     }
   return(rates_total);
  }

Con risposta

1
Sviluppatore 1
Valutazioni
(885)
Progetti
1410
67%
Arbitraggio
123
32% / 41%
In ritardo
218
15%
Gratuito
Pubblicati: 1 codice
2
Sviluppatore 2
Valutazioni
(590)
Progetti
789
71%
Arbitraggio
9
33% / 33%
In ritardo
22
3%
Gratuito
Pubblicati: 8 codici
3
Sviluppatore 3
Valutazioni
(221)
Progetti
412
61%
Arbitraggio
13
38% / 23%
In ritardo
163
40%
Gratuito
Pubblicati: 45 articoli, 1 codice
4
Sviluppatore 4
Valutazioni
(1156)
Progetti
1462
63%
Arbitraggio
21
57% / 10%
In ritardo
43
3%
Gratuito
5
Sviluppatore 5
Valutazioni
(2313)
Progetti
2912
63%
Arbitraggio
122
44% / 25%
In ritardo
429
15%
In elaborazione
6
Sviluppatore 6
Valutazioni
(1122)
Progetti
1810
61%
Arbitraggio
14
64% / 7%
In ritardo
84
5%
Gratuito

Informazioni sul progetto

Budget
10 - 15 USD
Scadenze
da 1 a 3 giorno(i)