"converting an indicator to an EA" is one of the most useless thing ever heard.
Create the EA from scratch, declare your indicator as resource and use iCustom.
Fabio Cavalloni #:
"converting an indicator to an EA" is one of the most useless thing ever heard.
"converting an indicator to an EA" is one of the most useless thing ever heard.
Create the EA from scratch, declare your indicator as resource and use iCustom.
Tks bro, I just check then find the method EA could work fine.
Then I am using LSMA for RSI, not STO STO change too fast.
//------------------------------------// //------- LSMA RSI--------------------// //------------------------------------// ArraySetAsSeries(rsi, true); ArrayResize(rsi, RSIPeriod+LSMA_Rsi_Period); ArraySetAsSeries(lsma_rsi, true); ArrayResize(lsma_rsi, LSMA_Rsi_Period); //------ Tính toán giá trị cho mảng rsi for(i = 0; i< RSIPeriod+LSMA_Rsi_Period; i++) { rsi[i] = iRSI(NULL,0, RSIPeriod,PRICE_WEIGHTED,i); } lsma_rsi[1] = 3.0 * iMAOnArray(rsi, 0, LSMA_Rsi_Period, 0, MODE_LWMA, 1) - 2.0 * iMAOnArray(rsi, 0, LSMA_Rsi_Period, 0, MODE_SMA, 1); lsma_rsi[2] = 3.0 * iMAOnArray(rsi, 0, LSMA_Rsi_Period, 0, MODE_LWMA, 2) - 2.0 * iMAOnArray(rsi, 0, LSMA_Rsi_Period, 0, MODE_SMA, 2);
int ID_BUY = OrderSend(NULL,OP_BUY,lot,Ask,10,Ask - pips_SL*Point,Ask + pips_TP*Point);
Be careful with NULL.
- On MT4, you can use NULL in place of _Symbol only in those calls that the documentation specially says you can. iHigh does, iCustom does, MarketInfo does not, OrderSend does not.
- Don't use NULL (except for pointers where you explicitly check for it.) Use _Symbol and _Period, that is minimalist as possible and more efficient.
- Zero is the same as PERIOD_CURRENT which means _Period. Don't hard code numbers.
- MT4: No need for a function call with iHigh(NULL,0,s) just use the predefined arrays, i.e. High[].
MT5: create them. - Cloud Protector Bug? - MQL4 programming forum (2020)

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
Hello everyone,
I am new to MQL4 programming. I have copied an indicator about Stochatis Smooth - LSMA (using iMAonArray), and the chart displays the calculated information correctly.
However, when I convert it to an EA, there are no errors during compilation, but the EA does not run.
I hope you can check and help me find the wrong at this code.
I have also searched for articles on the same topic, but the solutions are not suitable, or maybe I did not understand (my English is poor) the method of these topic on 4rum.
(I'm still reading Topic by Nikolay Kositsin to find the method convert Indecaotor to EA)
This my EA code - Stochatic smooth (when change LSMA2 > LSMA 1 -> Sell; when LSMA1>LSMA2 -> Buy)