I made a simple free expert for a local trader community. However some users keep reporting unwanted position closings.
The code is simple and after various re-checking (and checking user behaviour and settings) I ha heve no idea why could it do the closings.
The expert watches Supertrend indicator. When eg. a long position is open, and Supertrend would turn against the position by changing direction to red, then the expert shall close the open long position. Hwever, users report that sometimes at bar close the expert closes positions while Supertrend not changing direction.
I even applied a line excluding the first ticks, but some still have problems using the expert. Not all, but some of them. User faults? Brokerage input falults? Or is there thing to improve?
Thank you for checking!
I think the problem is your switch . . . you need to break once you have completed the code for the OP_BUY case . . . otherwise the code for the OP_SELL case is also executed . . .
Read the switch example code . . .
THank you RaptorUK
I applied a break; before case OP_SELL:
Let met get it tested.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I made a simple free expert for a local trader community. However some users keep reporting unwanted position closings.
The code is simple and after various re-checking (and checking user behaviour and settings) I ha heve no idea why could it do the closings.
The expert watches Supertrend indicator. When eg. a long position is open, and Supertrend would turn against the position by changing direction to red, then the expert shall close the open long position. Hwever, users report that sometimes at bar close the expert closes positions while Supertrend not changing direction.
I even applied a line excluding the first ticks, but some still have problems using the expert. Not all, but some of them. User faults? Brokerage input falults? Or is there thing to improve?
Thank you for checking!