# Experts: Fuzzy logic

Moderator
192534

An expert advisor that makes a decision on the basis of the indistinc logic (so-called Fuzzy logic). The A. Nedosekin's (http://sedok.narod.ru/scoring_USA.html) materials were used during the development of the classificator and the resultant for ranks.

Author: Алексей

1262

what time frame?

130

puncher:

what time frame?

any
16316

Bass:
puncher:

what time frame?

any

Hello Bass,

I am testing the Fuzzy logic EA and for the two first week it made good profits. But when I looked closely at the way it was behaving, my fear became reality this week with a HUGE loosing position of -1000. What happens is that whenever the market goes against the position taken, the EA doesn't have a S/L. That means it lets the market ride with it and you could get in big trouble. Then and if the market reverse and become profitable, then the EA puts a S/L order the same as the entry price, that's why you have so much trades at 0. If the market goes more in the money then a trailing stop loss is trigger at 35 pips. For the past two days EURUSD has been going up, against the sell position taken two days ago by the EA. There is no S/L and i'm now at a projected loss of -1000. How come there is no S/L when into a loosing position ??

Thanks

Denis

16316

Hello Bass,

I interest your idea. After I test your EA, I found some problem.

1) Your fuzzy EA open only SELL order. I found the return value of FuzzyLogic()
function alway below 0.5. Then, I look into FuzzyLogic and found wrong
value and code
1.1) Size of Array variable in FuzzyLogic function are wrong.
1.2) I think values of Array arGator are wrong number, The SumGator variable
is too small (below 0.01)
1.3) The double loop before finish the function has wrong code.

```for (x=0;x<5;x++)       /* all element from 0 to 4 */
{
for (y=0;y<5;y++)     /* all element from 0 to 4 */
{
Summary[x] = Summary[x] + Rang[y,x]*Weight[y];     /* index of Weight */
}
}

for (x=0,Decision=0;x<5;x++)    /* initialize Decision */
{
Decision = Decision + Summary[x]*(0.2*(x+1)-0.1);
}```

2) In testing it generate many error order codes. I found your EA code
send Order to server more than one in single tick. In start() function
After it call CheckForOpen() function that send OrderSend() to server,
SetStopLoss() function is called and it send OrderModify() to server and then
it send OrderModify() in start() function again before finish. It send 3 order
to server in single tick!!!

```if(CalculateCurrentOrders(Symbol())==0)
{
CheckForOpen();
return;      /* finish OrderSend */
}

if (FirstSL==True)
{
if (SetStopLoss())     /* return the tic  */
{
FirstSL = False;
}
return;   /* finish 1st OrderModify */
}```

In SetStopLoss() function has wrong code
`  StopLoss=NormalizeDouble(SL*Point,0);`

It alway zero. I change to

`  StopLoss=NormalizeDouble(SL*Point,Digits);`

Thanks

33

This system is brilliant.  I have been studying fuzzy logic theory and to my knowledge it has never been applied to Forex EA trading.  The system itself definitely needs tweaking, it will only sell, but this system shows a lot of promise.  Thanks for submitting it.  If you have any new updates to the system you would be willing to share I would love to see them.  If you want to know how I have been successfully trading this system please contact me directly.  Thanks again!  Great job Bass!!!!
399

Ea is not setting any stoploss because of line in function SetStopLoss():

StopLoss=NormalizeDouble(SL*Point,0);

It should be

StopLoss=NormalizeDouble(SL*Point,Digits);
to setup stoploss proper way