Can Hedge mode be flipped on and off in multi-asset strategy?

Posted By: dusktrader

Can Hedge mode be flipped on and off in multi-asset strategy? - 11/04/13 19:40

I am wondering if I can flip between Hedge=0 and Hedge=4 in a multi-asset strategy?

Depending on the asset, different parameters are set and I'm wondering if Hedge can also be safely changed after the asset is set. Some assets in the loop will use Hedge=0 while others will use Hedge=4 mode.

Thanks
Posted By: dusktrader

Re: Can Hedge mode be flipped on and off in multi-asset strategy? - 11/04/13 20:23

In doing a little testing, it seems that:
* Hedge mode cannot be set after the asset() command
* Hedge mode can be set before asset(), but further mode sets inside the asset() loop are ignored

As a feature request then, if not impossible to do, please consider making it possible to change Hedge on a per-asset basis. Some assets perform better with Hedge=0 while others Hedge=4. It seems on Zorro 1.16 that you can only set it once per strategy.

Thanks
Posted By: jcl

Re: Can Hedge mode be flipped on and off in multi-asset strategy? - 11/05/13 11:51

Hedge affects opening and closing of trades, and has nothing to with asset(). I also see nothing to the contrary in the documentation, so it should not be a problem to set Hedge anytime.
Posted By: dusktrader

Re: Can Hedge mode be flipped on and off in multi-asset strategy? - 11/05/13 15:55

I hear what you are saying, but it doesn't seem to work that way. If you like I can provide an example demonstrating this. It would be great if Hedge could be changed (throughout a multi-asset strategy, for example) but if not that's fine too.
Posted By: jcl

Re: Can Hedge mode be flipped on and off in multi-asset strategy? - 11/05/13 17:25

Can you explain more about your example? In which way does Hedge not seem to work?
Posted By: dusktrader

Re: Can Hedge mode be flipped on and off in multi-asset strategy? - 11/05/13 18:53

In a multi-asset strategy, I would like to switch between Hedge=0 and Hedge=4, depending on which asset is chosen.

I have measured the values of what each Hedge mode yields, and that is why I think it is not switching the way I expect. I don't mind putting together a sample code to demonstrate this ... after all, maybe I'm doing something wrong on my end. (Once I get finished with my current task, I'll put together a simple example so you can see what I mean)
Posted By: jcl

Re: Can Hedge mode be flipped on and off in multi-asset strategy? - 11/06/13 11:34

Ok, if I get this example in the next 2 days, we can still fix it for 1.20 if it's indeed a bug. So far I can not see any problem with different Hedge settings depending on assets. Check the log - there you can easily see if Hedge works correctly or not. Phantom trades are in winged brackets.
Posted By: dusktrader

Re: Can Hedge mode be flipped on and off in multi-asset strategy? - 11/06/13 11:42

I'll have something for you today. I think it's hard to simulate a Hedge issue, but I happened to stumble across one in a tradebot I'm working on. It may not be the most simple example, but its obvious something is not working as expected (ability to switch modes as assets switch, for example)
Posted By: dusktrader

Re: Can Hedge mode be flipped on and off in multi-asset strategy? - 11/06/13 15:03

At this point, I'm unable to reproduce the issue I saw before. That means it could very well have been something I was doing wrong in the code. The code I'm working on has gone through a lot of improvements since I originally posted about this.

I am going to move forward and utilize the Hedge switching in my strategy, and keep an eye on it. I no longer think this is an issue.

Thanks
Posted By: dusktrader

Re: Can Hedge mode be flipped on and off in multi-asset strategy? - 11/06/13 16:07

jcl, there is still a possible issue with flipping Hedge mode on and off. I've gone ahead and posted the strategy I'm working on in this thread so you can take a look. Sorry in advance for it not being a simple example.

The issue is that AUDUSD works better with Hedge=4 in my testing. But if I attempt to enable that (code line 179) while leaving the other 2 assets on Hedge=0, I get a Zorro crash during Test.

I have been able to get the Hedge mode to switch back and forth, but sometimes it does this and crashes. Therefore, it seems that it could be an (intermittent) bug.
Posted By: jcl

Re: Can Hedge mode be flipped on and off in multi-asset strategy? - 11/07/13 09:11

Thanks for the example - and yes, it seems that you found a bug that is indeed related to virtual hedging. I've forwarded this to the developers. It's good that this was reported just in time, so it can be fixed for the 1.20 release.
Posted By: dusktrader

Re: Can Hedge mode be flipped on and off in multi-asset strategy? - 11/07/13 10:42

Awesome! Thanks.
© 2024 lite-C Forums