Errors in EA and not behaving as it is wanted
Your topic has been moved to the section: MQL4 and MetaTrader 4
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
Santanu Das: A few times the order send error 130 is also apprearing.
buySellTicket=OrderSend(NULL,OP_BUYSTOP,LotSize,buyLimitPrice,3,0,0,NULL,MagicNumber,0,clrGreen);
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)
Hello MQL5ers
My EA is not acting as I wanted it to be. My intentions were as follows:
I am unable to find out where I am going wrong and would appreciate if some kind soul can help me to get it right. I am pasting the whole code hereunder: