Control the parameters of the functions call, use the debugger:
Code debugging: https://www.metatrader5.com/en/metaeditor/help/development/debug
Error Handling and Logging in MQL5: https://www.mql5.com/en/articles/2041
Tracing, Debugging and Structural Analysis of Source Code, scroll down to: "Launching and Debuggin": https://www.mql5.com/en/articles/272
- www.metatrader5.com
int RSIDefinition = iRSI(_Symbol, _Period, 15, PRICE_CLOSE); // copy the RSI values into the array CopyBuffer(RSIDefinition, 0, 0, 3, RSIArray)
Perhaps you should read the manual, especially the examples.
How To Ask Questions The Smart Way. (2004)
How To Interpret Answers.
RTFM and STFW: How To Tell You've Seriously Screwed Up.
They all (including iCustom) return a handle (an int). You get that in OnInit. In OnTick/OnCalculate (after the indicator has updated its buffers), you use the handle, shift and count to get the data.
Technical Indicators - Reference on algorithmic/automated trading language for MetaTrader 5
Timeseries and Indicators Access / CopyBuffer - Reference on algorithmic/automated trading language for MetaTrader 5
How to start with MQL5 - General - MQL5 programming forum - Page 3 #22 (2020)
How to start with MQL5 - MetaTrader 5 - General - MQL5 programming forum - Page 7 #61 (2020)
MQL5 for Newbies: Guide to Using Technical Indicators in Expert Advisors - MQL5 Articles (2010)
How to call indicators in MQL5 - MQL5 Articles (2010)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi Everyone.
Could anyone please advise me on the following. I have an EA with a trailing stop Loss for the sell position. What I do not understand is that when the open positions goes into profit the my TP moves up and not the SL to come down. It should work that once an position is in Profit then the SL for that position should then move down and trail the profit position with 3000 points in order to prevent it from running out my profit if the market change. This is to be used on cash 500.I cant seem to see where I have gone wrong as now when the position is in profit , my take profit moved closer thus causing me to loose out on extra profit but not helping if the market change on me. If anyone could please just point me in the correct direction I would be very happy please. I am new to coding and took me a while to compile this EA but now I am just stuck at this one point.