CoverAtClose set the exit price with High of the bar instead of Close
Author: DamV
Creation Date: 2/1/2018 4:00 PM
profile picture

DamV

#1
Here is the code:

CODE:
Please log in to see this code.


Here is the result:

QUOTE:
1.42854040648343
1.85344850752334 3.35220860466242 3.4966923743128
1.85815164352637 1.75109700052215 3.53874219594021
1.2883203201957 1.42854040648343 2.80277711464596
2.08326167677291 3.64736578251462 3.95135555277604
profile picture

Eugene

#2
Then you must have activated slippage which, according to the QuickRef...

QUOTE:
Slippage, when activated, can affect the trade's execution price.
profile picture

DamV

#3
Slippage is not checked. I ran the same code touching all options of slippage, always the exact same results.
profile picture

Eugene

#4
In the output of PrintDebug, the Low and High are mixed up which is nonsense. Either your data is wrong or something else that you aren't showing.
profile picture

DamV

#5
I 'm showing everything - the exact code and log.
But maybe it's a bug in your CreateSyntheticOption because the position is an option.
IT SEEMS THAT THE BUG IS ONLY FOR A PUT OPTION. If I test the same code with a call it works well...(High and Low not mixed and Exit=Close)
Here is a simple code to reproduce it . I ran it on BIB.

CODE:
Please log in to see this code.


Results:
QUOTE:
--------------
Exit:1.05695727925944
Close:1.15979345405476
Open:1.66436094115488
High:1.05695727925944
Low:1.66436094115488
--------------
Exit:2.38671775302502
Close:3.19836760286262
Open:3.20486781951663
High:2.38671775302502
Low:3.51192239012904
--------------
Exit:2.92289344711577
Close:3.43565018441392
Open:3.67512728172291
High:2.92289344711577
Low:4.09538486337685
--------------
profile picture

Eugene

#6
QUOTE:
But maybe it's a bug in your CreateSyntheticOption because the position is an option.

That's right. As states Open Issues,
QUOTE:
* The OHLC values of synthetic put contracts are incorrect (unlike calls)
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).