please someone help me
I'd start by looking at the return values on your OrderModify function calls.
- Check your return codes when you have an error. Not at the end.
What are Function return values ? How do I use them ? - MQL4 forum and Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles
OrderModify(OrderTicket(),0,OrderStopLoss(),tps,0 ... OrderModify(OrderTicket(),0,slb,OrderTakeProfit(),0
You modify the TP, but since there is no RefreshRates() after the first modify, OTP will still be returning zero. So the second modify sets the SL and unsets the TP.- In the presence of multiple orders (one EA multiple charts, multiple EA's, manual trading) you must count down when closing/deleting/modifying in a position loop. Get in the habit of always counting down. Loops and Closing or Deleting Orders - MQL4 forum
if (OrderSelect(i-1,SELECT_BY_POS)==true)
You would never write if( (2+2 == 4) == true) would you? if(2+2 == 4) is sufficient. So Don't write if(bool == true), just use if(bool) or if(!bool). Code becomes self documenting when you use meaningful variable names, like bool isLongEnabled. Long_Entry sounds like a trigger price or a ticket number and "if long entry" is an incomplete sentence.if(CloseOnOpposite==true)closesell=1; if(closesell==1||closebuy==1||openbuy<1||opensell<1){// start
Don't use zero/one when you mean true/false
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
i am new to this mql4 and i am trying to modify a existing RSI based ea and i want to set previous bars difference between high and low as the take profit and stop loss level by
doing like this
but this is not working, it is placing just a takeprofit level just were the order executed and not setting any stoploss levels, If the problem is just from the above code please correct me and if not where is the problem
in this?
Please help me, thanks