Forum on trading, automated trading systems and testing trading strategies
When you post code please use the CODE button (Alt-S)!
-
Please edit your (original) post and use the CODE button (Alt-S)! (For large amounts of code, attach it.)
General rules and best pratices of the Forum. - General - MQL5 programming forum 2019.05.06
Messages Editor -
Why did you post your MT4 question in the MT5 General section instead of the MQL4 section, (bottom of the Root page)?
General rules and best pratices of the Forum. - General - MQL5 programming forum?
Next time post in the correct place. The moderators will likely move this thread there soon. - sbm80: However, the orders don't seem to obey the RSI criteria, could someone please help?
Use the debugger or print out your variables, including _LastError and prices and find out why. Do you really expect us to debug your code for you?
-
Please edit your (original) post and use the CODE button (Alt-S)! (For large amounts of code, attach it.)
General rules and best pratices of the Forum. - General - MQL5 programming forum 2019.05.06
Messages Editor -
Why did you post your MT4 question in the MT5 General section instead of the MQL4 section, (bottom of the Root page)?
General rules and best pratices of the Forum. - General - MQL5 programming forum?
Next time post in the correct place. The moderators will likely move this thread there soon. -
Use the debugger or print out your variables, including _LastError and prices and find out why. Do you really expect us to debug your code for you?
I’m quite new to this, so don’t know everything, your response is arrogant, rude and patronising, I’m just asking for help, don’t be so aggressive.
-
The rudeness here, is people expecting coding done, for free, just because they ask. That is what 12-year-olds do. Adults, don't expect handouts, they work for what they want. There are no slaves here.
-
If they just want a freebe, or start whining when they don't get it, then they need to grow up. They've wasted our time with their post, so they don't deserve niceness. Political Correctness is trying to pick up a turd by the clean end. The more you do it the worse it gets.
-
The rudeness here, is people expecting coding done, for free, just because they ask. That is what 12-year-olds do. Adults, don't expect handouts, they work for what they want. There are no slaves here.
-
If they just want a freebe, or start whining when they don't get it, then they need to grow up. They've wasted our time with their post, so they don't deserve niceness. Political Correctness is trying to pick up a turd by the clean end. The more you do it the worse it gets.
You have been asked twice already.
Please edit your post and use the code button (Alt+S) when pasting code.
EDIT your original post, please do not just post the code correctly in a new post.
Yet you still haven't done it.
You have been asked twice already.
Please edit your post and use the code button (Alt+S) when pasting code.
EDIT your original post, please do not just post the code correctly in a new post.
Yet you still haven't done it.
I'm not a moderator but I will answer in the name of the users.
YES!
Because if it is not properly formatted we cannot read it properly in order to analyse it and respond!
After analysing it, I can say this ... it has errors and it won't even compile! Did you post the code correctly?
Take for example the following:
if((RSI1CUSTOM>70)&&(halt1!=1)&&(TradeTimeOk==1) && Day()>= 5 && Day() <= 15{ int opensell=OrderSend(Symbol(),OP_SELL,Lots,Bid,Slip,0,0,"TEMPLATE",MagicNumber1,0,Green); }
If you run it through the styler, you can clearly see that it is missing a bracket for the condition:
if( (RSI1CUSTOM>70) && (halt1!=1) && (TradeTimeOk==1) && Day()>= 5 && Day() <= 15 // Missing a bracket { int opensell=OrderSend(Symbol(), OP_SELL, Lots, Bid, Slip, 0, 0, "TEMPLATE", MagicNumber1, 0, Green); }
So, please fix up the compile errors first and make sure to fix the warnings too, then retest it and post it here again, if you are still running into problems.
EDIT: You are also using very old type MQL4 code which may even be obsolete in some cases. Try to code in proper modern MQL4+ code and use proper styling. Use the built-in styler if you have to.
Also, structure your code in a more organised way. Your code is much too "stringy", making it difficult to read as well as to analyse and spot the problems.
Don't write such long lines.
No need to repeatedly call functions when the value never changes between calls. Save the results as variables. Break it down and organise the logic so that will be easier to read and and spot the problems.if((OrderMagicNumber()==MagicNumber2)&&(OrderTakeProfit()==0)&&(OrderSymbol()==Symbol())){ int modify1=OrderModify(OrderTicket(),0,OrderStopLoss(),tpb,0,CLR_NONE); } if((OrderMagicNumber()==MagicNumber1)&&(OrderTakeProfit()==0)&&(OrderSymbol()==Symbol())){ int modify2=OrderModify(OrderTicket(),0,OrderStopLoss(),tps,0,CLR_NONE); } if((OrderMagicNumber()==MagicNumber2)&&(OrderStopLoss()==0)&&(OrderSymbol()==Symbol())){ int modify3=OrderModify(OrderTicket(),0,slb,OrderTakeProfit(),0,CLR_NONE); } if((OrderMagicNumber()==MagicNumber1)&&(OrderStopLoss()==0)&&(OrderSymbol()==Symbol())){ int modify4=OrderModify(OrderTicket(),0,sls,OrderTakeProfit(),0,CLR_NONE); }

- 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 all,
When I run the code below in MT4 tester, the stoplosses and take profits in general seem to be okay, as do the date ranges for executing the strategy.
However, the orders don't seem to obey the RSI criteria, could someone please help? It is like the RSI condition is being ignored and a trade opens as soon as the last one closes
Thanks! -