Hello everybody,
I am facing a problem in logging trades for a sharp understanding, what Zorro is dealing with the broker exactly. Ordering, entering, exiting via MT4-bridge works reliable fine.
I enter a trade via
ASSET_long_Ask_at_EntryCmd = priceClose(0);
enterLong(MyTMF_long);
or…
ASSET_short_Ask_at_EntryCmd = priceClose(0);
enterShort(MyTMF_short);
Exactly one command line before enterXX() command is triggered, I record the current valid ASK tick value at which zorro decides to trade.
In the TMFs (I use one TMF for long + one for short) I then let zorro pass me the real ASK at which the broker booked the trade into my account :
<TMF short>
…
if(TradeIsEntry)
{
…
ASSET_short_Ask_at_EntryBroker = TradePriceOpen;
…
}
For long and short trades, zorro can calculate the real slippage for each trade, so I can adjust my trade- and stop- planning.
BUT :
to be in full control of an active trade, I also need to know values of SPREAD during entry and exit. According zorro’s manual TMF-variables …
####SNIP###
TradeSpread
The ask-bid spread at the trade opening time for short trades, or at the current and trade closing time for long trades.
###SNAP###
…I try to operate the same way as I did with ASK values.
Tracking the „real SPREAD-value“ works well with all LONG trades, where SPREAD is charged during exit.
But it does not work during the entry of SHORT trades.
I can not get the "SPREAD-value“ from the related trade returned to zorro, via the following code the return value is always zero (0.0)
<TMF short>
…
if(TradeIsEntry)
{
…
ASSET_short_Spread_at_EntryBroker = TradeSpread;
…
}
…the same code inside the long-Trade TMF during exit works fine
<TMF long>
…
if(TradeIsClosed)
{
…
ASSET_long_Spread_at_ExitBroker = TradeSpread;
…
}
Can anybody give me a hint, what I am doing wrong.
Regards
Hendrix