# logical confusion

238
2014.03.19 10:58

Thare are two expert diagrams below.

The logics are the same but results are different.

and "C" output must be the same but they differ.

Is there anyone to explain it?

I have real examples about them .

The results always differ.

1. EXAMPLE

If (condition1)

{

}

If (condition2)

{

}

C=OrderClosePrice-OrderOpenPrice ;

Print(C);

return:

2.EXAMPLE

If(condition1)

{

}

If(condition2)

{

B=Bid;

}

C=B-A;

Print (C);

return;

Moderator
18002
2014.03.19 11:50
pascalboy:

Thare are two expert diagrams below.

The logics are the same but results are different.

and "C" output must be the same but they differ.

Is there anyone to explain it?

I have real examples about them .

The results always differ.

They are only the same if you do the 2 condition1s during the same tick, and the 2 condition2s during the same tick . . . or maybe I am misunderstanding your example/question ?

Also in example 1 placing the order will take some time so that the Bid price may have changed, in example 2 the Bid and Ask look like they will be from the same tick.

238
2014.03.19 17:26
I am misunderstanding your example/question ?

Also in example 1 placing the order will take some time so that the Bid price may have changed, in example 2 the Bid and Ask look like they will be from the same tick.

238
2014.03.19 17:28
You understood right. But this logic is wrong.
2584
2014.03.19 18:01

The only way that could work reliably is if you send your trade functions with no slippage and assign the bid and ask prices to A and B as they are when you send the open or close order so if the order is rejected by requote and you refresh rates you can re assign the Bid or Ask to A or B.

Moderator
18002
2014.03.19 19:57
pascalboy:
You understood right. But this logic is wrong.
Exactly what is wrong ? if your 2 examples do different things how can you possibly expect the same outcome ?
Moderator
9642
2014.03.19 22:07
```If (condition1)

{
Open Buy Order    //Order sent @ 1.5000, but with slippage is executed at 1.5001
a=OrderOpenPrice  // 1.5001
}```
238
2014.03.20 16:17

i do not think 1-10 points slippage effect so much.

i tried example-2 between 01.01.2011-06.02.2014.

the sum of C was 40.

and C has never been negative.

i tried example -1 at the same period the

last balance was 1,05 times the initial balance .

after

i added vertical lines to example-1 at open order and close order points .

the vertical lines jumped 4-5 hours from some of the buy or close points.

Maybe there can be a jump at the program loop.Does not matter but it is strange .Thanks for your opinion.

2584
2014.03.20 16:28

If you post code examples properly people would understand what you mean.

Slippage would make a difference, the Bid and Ask would be as they were when you sent the order. If there was 2 points slippage it would make the OrderOpenPrice() 2 points different from the ask.

```If (condition1)
{
}

If (condition2)
{