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.
Open Buy Order
Close Buy Order
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.
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.
A=Ask // 1.5000
Open Buy Order //Order sent @ 1.5000, but with slippage is executed at 1.5001
a=OrderOpenPrice // 1.5001
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 .
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.
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.
//open Buy Order (no slippage)
//close Buy Order (no slippage)
C = OrderClosePrice()- OrderOpenPrice() ;
Print("C = ",C);
D = B-A
Print("D = ",D)
To add comments, please log in or register