Hedging issue?

Posted By: DdlV

Hedging issue? - 05/19/16 23:26

Hi jcl. I believe I have found a Hedging/upgrade issue. If not, I would appreciate the explanation! laugh

When I upgraded to Z12 1.44 there were 1 VO virtual and 1 real XAU/USD Short trades open, both for 4 units, and both were resumed by 1.44.

The next day, the real trade was Closed - all 4 units. But there was no mention of the virtual trade. At the time I assumed this was a reporting oversight.

A few days later, VO again went virtual Short 4 units, and a real Short of 4 units was entered.

Later, A2 went virtual Long 3 units, and a real Short of 1 unit was entered. Why?!

It seemed as though the original virtual VO Short is still sitting there as something Zorro wants to do, so when the A2 virtual Long arrives, it nets to the 1 real Short. On this suspicion I checked the Z12.htm and in fact, yes, the original virtual trade has not been closed and is still there.

I've noticed in looking back at the logs that sometimes when a real is closed there can be a lag of up to 8 bars before the virtual is closed. Could the close of the original virtual have somehow gotten lost due to the upgrade?

Please let me know what I should do about both the virtual trade that didn't close as well as the extra real Shorts it caused that are now active.

Thanks.
Posted By: jcl

Re: Hedging issue? - 05/23/16 07:30

You must not manually close any virtual trade. Only your strategy is supposed to do that when a stop is triggered or a close condition is fulfilled. I can not see from your post if something is wrong with your trades, but if you think so, please post them here.
Posted By: DdlV

Re: Hedging issue? - 05/23/16 12:22

I don't know how to externally manually close a virtual trade, so haven't done that.

In any case, to me the problem seems to be the opposite: that Z12 closed a real trade but did nothing on the virtual side.

Will send log via PM.

Thanks.
Posted By: jcl

Re: Hedging issue? - 05/23/16 16:32

For comparing real and virtual trades, look into the list of trades and check if the positions match. If something's wrong, please post the trade list so that I can see what the problem is.

Real and virtual trades can be different when a real trade is manually closed. In that case the trade is not immediately reopened. Instead the difference will stay until the virtual position closes. This allows you to manually close trades in case of an emergency. It's a feature, not a bug laugh.
Posted By: DdlV

Re: Hedging issue? - 05/23/16 19:58

Yes, the real & virtual trades should match. However, in this case I don't believe they do - see below. Also, I've noticed in checking other asset examples that a number of bars can go by after a real close before the virtual trades are closed so the trades return to sync/match. All of this is without any manual closing - Z12 is the only thing closing trades.

In this case:

1) Start of Z12 1.44: VO:s 4; NET:S 4 - match.
2) Next the NET:S 4 was closed; but the virtual was not: VO:s 4; NET:S 0 - NO MATCH.
3) Next VO:s for 4 and NET:S for 4: VO:s 8; NET:S 4 - NO MATCH.
4) Next A2:l for 3 and NET:S for 1: VO:s 8, A2:l 3; NET:S 5 - MATCH.

Log PM'd that shows this. At 1st glance you might say the feature is working fine, because match has been restored. However, that assumes that in step 2 the virtual was not supposed to be closed by Z12 when it closed the real. This is what I don't understand: Why didn't Z12 close the virtual in step 2 when it closed the real?

If the virtual had been closed in step 2, step 3 would change to MATCH with 4 & 4, and step 4 would still be in match but with 4 shorts - 3 longs = 1 short and on the real side 3 Shorts being covered leaving 1 Short.

The feature you're describing is to keep the real trades in sync with the net of the virtual trades, and that's great. But the question here isn't that - it's whether the virtual trades that the feature depends on are correct.

Thanks.
Posted By: jcl

Re: Hedging issue? - 05/24/16 11:32

Again: Zorro will NOT close a virtual trade when a real trade is closed. It is up to the script, by a stop loss or other criteria, to determine when a trade must be closed. Closing a real trade should have no effect on the behavior of a strategy.

Any position difference by externally closing trades, such as that NET:S trade in your step 2), will stay until it is levelled by the strategy. This is perfectly normal behavior as described in the manual, and is no reason to worry.
Posted By: DdlV

Re: Hedging issue? - 05/24/16 12:12

Again: I did NOT close that NET:S trade in step 2. Zorro closed it!!! You can see this in the log I PM'd.

I have NOT closed nor opened ANY of these trades. They are ALL opened and closed by Zorro Z12.

So, the question still remains: When ZORRO Z12 closed the NET:S trade in step 2, why didn't ZORRO Z12 close the corresponding virtual VO:s trade?

If this is perfectly normal behavior, please help me understand why Zorro and/or Z12, with NO manual interference from me at all, desynchronizes virtual and real so that the total net trades do not match.

Thanks.
Posted By: jcl

Re: Hedging issue? - 05/24/16 12:17

I don't want to argue who closed your trade, but it was most likely not Zorro, since a strategy can not directly close a NET trade. There is no mechanism for this. Strategies close only their own trades. NET trades are closed either by a change of virtual positions, or externally by the broker platform. You can see this in the log. "Close" means externally closed, "Sell" or "Cover" means by changing virtual long or short positions. If you did not do it, then maybe the broker did it for some reason - you should see this in the closed trade list of the TS.
Posted By: DdlV

Re: Hedging issue? - 05/24/16 14:34

I don't want to argue either! But I do want to get to the bottom of what happened so I understand. laugh For which it is important to know who & why closed the trade. If you (Zorro laugh ) didn't and I didn't, that leaves FXCM. TS is no help - it and the reports just say it was closed - not by who or why. I have therefore emailed FXCM and will let you know their response.

Apologies for misunderstanding the "Close" message - I do now see the manual says that means closed by the broker. Although I suppose this could be as a result of a Stop set/updated by Zorro...

Thanks.
Posted By: jcl

Re: Hedging issue? - 05/24/16 14:40

The trade messages are listed on the "Trading" page. A stop is less likely: NET trades have indeed stops, but they are very distant and only supposed to be triggered by large price moves.
Posted By: DdlV

Re: Hedging issue? - 05/25/16 14:59

Hi jcl.

Yes, I have read that page many times in the past, and also again in the last days. laugh My recollection was of the "externally closed" message, and not seeing that assumed Zorro had done the closing. I'm now better informed that "closed" with or without "externally" means Zorro didn't do it.

FXCM has responded that the trade was closed due to Stop. I did not manually set a Stop, and there are no Trail messages in the log indicating that Zorro updated the Stop. I have asked FXCM for the Stop history of this trade and will advise their reply.

Now that I know what "closed" means laugh , I see 2 other instances in April where XAU/USD trades were Closed - presumably also due to Stop and without my setting a Stop or any Trail message appearing. This has not happened to date (since April) with any other Asset. I will wait for the above trade to be resolved before looking further into these trades.
Posted By: DdlV

Re: Hedging issue? - 06/09/16 13:02

Hi jcl,

FXCM says the Stop on that trade was only set once.

I have also looked again at the logs and there are a couple of other instances where, without any change in Stop reported, the NET trade was closed before the virtual trade.

It appears that the Stop on the NET trade is being set tighter than the Stop on the virtual trade. And/or the NET trade is using the tightest Stop of all the trades it's netting, therefore closing more than it should. And/or when a partial close happens due to a (correct) tight stop that corresponds to the virtual trade being closed, the Stop is not being reset to the (further away) stop of the remaining virtual trade(s). Or ... ?

What do you think?

Thanks.
Posted By: jcl

Re: Hedging issue? - 06/09/16 16:43

Yes, I would also suspect a too tight stop. But on the other hand, the stops of NET trades are set at 30% below the entry price, and XAU didn't drop 30%. In our Z3 trade records I see no irregular stops of NET trades. What was the stop value and the entry value of that trade?
Posted By: DdlV

Re: Hedging issue? - 06/09/16 22:44

PM sent. To clarify, this is Z12, not Z3.

Thanks.
Posted By: jcl

Re: Hedging issue? - 06/10/16 07:59

The log that you sent has no stops. You can see the stops in the Zorro trade list and also in the TS open position list, but they show open positions only. For past positions you can get the stop and entry price from FXCM.

For current trading, check the stops in the trade list. All pool trades must have distant stops, or else something is wrong.
Posted By: DdlV

Re: Hedging issue? - 06/10/16 13:17

The columnar-formatted log extract that I sent has exactly what Zorro prints in the log for these trades! Perhaps Zorro can print more?

Most if not all of these trades are now closed, so neither the Zorro trade list or TS open position list are of any value.

As I'm sure you're aware, getting things from FXCM can be like pulling teeth... frown

I was able to get one past Stop from FXCM which I gave in the PM. I did not set this Stop. Zorro (or someone else?) did. It caused the NET trade to be closed before the virtual trade. The log shows the open price as requested - what other info is needed? Can you determine what happened with this trade?

The log also contained other instances of NET trades being closed before virtual. I have not manually changed any of these Stops.

I also noted some real trades that are not showing as NET, but showing with Algo IDs - is this normal for some reason with Hedge=5?

This seems a lot of smoke for there to be no fire. What else would you like me to provide / ask of FXCM to get to the bottom of this?

Thanks.
Posted By: jcl

Re: Hedging issue? - 06/13/16 08:22

Only the list of trades. You need not pull the teeth out of FXCM, they store all your trades and you can just download the list from your account page. I only need the line of a single prematurely closed trade.

Pool trades have the same algo names as the trades that triggered them. Only when they are not triggered by a single trade, they get the identifier "NET".

The Zorro log would have all info for looking into a particular trade, especially the stops, but only from a certain Verbose level on. So just for the case that you get similar issues again in the future, please set Verbose to 7. Then I can see anything from the log.
Posted By: DdlV

Re: Hedging issue? - 06/13/16 13:34

Thanks jcl.

Just to be sure I'm understanding, exactly which report would you like me to run at FXCM?

If I change Verbose to 7 in Z12.ini, will it take effect on the next bar? Or does changing Verbose require a restart?

Would Verbose 15 (7+8) be better?

Thanks.
Posted By: jcl

Re: Hedging issue? - 06/14/16 08:29

If I remember right, the trade list is named "account transactions" or "account report" or the like - should not be too hard to find.

I believe Verbose requires no restart. You should see a message after the next bar about the Verbose change. 15 is not necessary, 7 is sufficient.
Posted By: DdlV

Re: Hedging issue? - 06/14/16 15:16

OK - I'll go look for it in the next day or 2.

Verbose=7 took effect on the next bar without restart. How much larger will that make the log file? 2x? 10x? 100x? If not too much larger, I'll use it as the setting for all strategies...

Thanks.
Posted By: jcl

Re: Hedging issue? - 06/15/16 07:47

About 2x.
Posted By: DdlV

Re: Hedging issue? - 06/15/16 13:58

OK, then I'll plan to use Verbose=7 always.

FYI, I changed Z3 to Verbose=7 also at the same time Monday (in Z3.ini), but Z3 has yet to reflect the change after 2 bars since... Bug?

Thanks.
Posted By: jcl

Re: Hedging issue? - 06/16/16 08:40

No, Z3 is also supposed to re-load the ini file when it has changed, just as Z12. It's the same code. For making sure, open Z3.ini and save it again. Check if you see the message after the next bar.
Posted By: DdlV

Re: Hedging issue? - 06/16/16 12:07

I checked the timestamp on Z3.ini and it showed 06-13 PM. It should have reloaded on 06-14, the 2nd bar after Weekend. I have re-Save'd Z3.ini and it now has a 06-16 modified date. I will advise tomorrow if the reload occurred.

To be sure we're not chasing a variant of the same problem, would the 23 hour, 7 minute BarPeriod be causing this also?

Thanks.
Posted By: jcl

Re: Hedging issue? - 06/16/16 18:32

Normally not, but which version are you using? Is it not the latest version?
Posted By: DdlV

Re: Hedging issue? - 06/16/16 19:33

This is on 1.44, the latest release version, correct? I don't plan to upgrade to 1.46 until it becomes the release version. As far as I know, the 1.45.x versions were never posted?

Thanks.
Posted By: DdlV

Re: Hedging issue? - 06/17/16 01:17

Z3 has posted the 06-17 bar and no Z3.ini reload happened. Next step?

Thanks.
Posted By: jcl

Re: Hedging issue? - 06/17/16 07:34

Wait until you're ready to update to 1.46. Then do that and restart the Z systems with Verbose at 7. We'll then look into the Z3 ini reload issue if it still happens on your system. My records say that ini reloading was already supported in 1.44, but I'm not 100% sure if this was also the case for Z3.
Posted By: DdlV

Re: Hedging issue? - 06/17/16 19:54

OK. Presumably 1.46 will become the current release next week, and I'll possibly be able to upgrade to it next weekend...
Posted By: DdlV

Re: Hedging issue? - 06/17/16 19:55

Separately, for the benefit of any who might have been following the original issue in this thread, the status is that the Z12 NET real trade was closed earlier than the virtual trade by a stop of unknown origin. The available Zorro records only contain a much more distant stop that was not hit by an outlier. Complete resolution of this issue is pending either further information about this trade and its stop, or the issue happening again on another trade.
Posted By: DdlV

Re: Hedging issue? - 08/09/16 11:23

For those following the original issue, it is at this point considered resolved by a fix implemented in 1.46.1 (unless it occurs again...).
Posted By: GPEngine

Re: Hedging issue? - 08/11/16 03:12

(terrifying)
© 2024 lite-C Forums