looper:i make this, and id dosen't work
- "Doesn't work" is meaningless - just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires - meaningless. There are no mind readers here.
double MainBuffer []; int OnInit(){ : if(MainBuffer[SIGNAL_BAR] - 30.0 > 0 &&
If you looked in the log file you would see the "array exceeded" message. Of course it doesn't work. MainBuffer has no size but you try access element 1.
i try to fix it,
extern int RSIPeriod=3; extern int ApplyTo=0; extern int OverBought=70; extern int OverSold=30; double RSIBuffer[]; double RSIOBBuffer[]; double RSIOSBuffer[]; int start() { int i; RSIBuffer[i]=iRSI(NULL,0,RSIPeriod,ApplyTo,i); RSIOBBuffer[i]=OverBought; RSIOSBuffer[i]=OverSold; i--; if(RSIBuffer[1]<OverBought && RSIBuffer[0]>=OverBought) { Alert("RSI = "+ RSIBuffer[i]+ ", Sell."); } if(RSIBuffer[1]>OverSold && RSIBuffer[0]<=OverSold) { Alert("RSI = "+ RSIBuffer[i]+ ", Buy."); } return(0); }
neither this code works
looper: i try to fix it,
double RSIBuffer[]; int start(){ int i; RSIBuffer[i]=iRSI(...); neither this code works |
|
thanks, i fix partly the problem
now the alam works only one time,
after i put on the cross it work one time and then stop working
if i change timeframe it works one more time and then stop
alarm rings only once
this is the new code
extern int OverBought=70; extern int OverSold=30; int OnInit() { int PrevSignal; double RSI_0 = iRSI(NULL,0,3,PRICE_CLOSE,0); double RSI_1 = iRSI(NULL,0,14,PRICE_CLOSE,1); if (PrevSignal <= 0) { if(RSI_0 > OverBought && RSI_1 < OverBought) { PrevSignal = 1; Alert("SELL"); } } if(PrevSignal >= 0) { if(RSI_0<OverSold && RSI_1 > OverSold) { PrevSignal = -1; Alert("BUY"); } } return(0); }
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
hi
I'm trying to make a simple ea but i have some problems
i want to make an ea with rsi and stochastic; when both indicatros cross 30 level i want a alram (the same when they cross level 70)
i make this, and id dosen't work
i searched on this formu and on google, but i can't fix the problem
i also read this https://www.mql5.com/en/articles/1448 and other pages
thanks