Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
2 registered members (Quad, AndrewAMD), 1,007 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Understanding Lots, Margin, Capital and Balance #427506
08/08/13 20:03
08/08/13 20:03
Joined: Jul 2013
Posts: 522
D
dusktrader Offline OP
User
dusktrader  Offline OP
User
D

Joined: Jul 2013
Posts: 522
I'm trying to get a grasp on these controls, so that I can understand how to properly utilize phantom/equity-curve trading.

My confusion is regarding Lots and how it interacts with Margin... for example, manual says:

Quote:
Lots
Trade volume given by the number of lots per trade (default = 1). One lot is the smallest possible order unit of the account (see remarks). If Margin and/or Risk are used for calculating the trade volume, set Lots at 1. If Lots is 0, no trades are executed. If Lots is negative, trades are executed in phantom mode (see below); they are only simulated, but not sent to the broker.
That seems a little contradictory... if I'm setting the Margin (for example, reinvesting based on OptimalF) then wouldn't that imply that Lots are > 1? When equity-curve trading, how do I indicate to Zorro that I want to come out of phantom mode but still honor my Margin setting for the next trade? Does Margin take precedence over Lots?

Code:
// equity curve trading: switch to phantom mode when the equity 
// curve goes down and is below its own lowpass filtered value
function checkEquity()
{
  vars EquityCurve = series(EquityLong+EquityShort);
  vars EquityLP = series(LowPass(EquityCurve,10));
  if(EquityLP[0] < LowPass(EquityLP,100) && falling(EquityLP))
    Lots = -1; // drawdown -> phantom trading
  else
    Lots = 1; // profitable -> normal trading
}

// reinvest the square root of your profits
checkEquity();
var MarginLong = sqrt(WinLong-LossLong)*OptimalFLong;var MarginShort = sqrt(WinShort-LossShort)*OptimalFShort;
Margin = clamp((MarginLong+MarginShort)/2, 5, 1000);

Will the above example code (from manual) work to put trades in and out of phantom mode and still adjust margin accordingly?

Separately, what is the difference between Capital and Balance?

THANKS in advance.

Re: Understanding Lots, Margin, Capital and Balance [Re: dusktrader] #427516
08/09/13 07:15
08/09/13 07:15
Joined: Jul 2000
Posts: 27,935
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,935
Frankfurt
In financial trading the trade volume can be determined in three different ways: for directly ordering a certain number of contracts, use Lots. For investing a certain amount of your account balance, use Margin and set Lots to 1. For risking a certain amount by determining the worst case loss, use Risk.

Balance is what you have on your account, Capital is just the CAGR calculation base.

Re: Understanding Lots, Margin, Capital and Balance [Re: jcl] #427553
08/09/13 11:04
08/09/13 11:04
Joined: Apr 2013
Posts: 57
3
3DCat Offline
Junior Member
3DCat  Offline
Junior Member
3

Joined: Apr 2013
Posts: 57
Can you use Risk and Margin at the same time?

Edit: OK, stupid question, since you can move both Sliders in Z-Strategies.
But somewhere i read the Sliders are not the same as the Variables

Last edited by 3DCat; 08/09/13 11:39.
Re: Understanding Lots, Margin, Capital and Balance [Re: 3DCat] #427556
08/09/13 12:28
08/09/13 12:28
Joined: Jul 2013
Posts: 522
D
dusktrader Offline OP
User
dusktrader  Offline OP
User
D

Joined: Jul 2013
Posts: 522
The sliders on the interface are programmed to variables in the script.

You can use both Risk and Margin, according to the manual (see my quote in first post, it says "Margin and/or Risk")

See the manual page "Margin, Risk, Lots" for full description

Re: Understanding Lots, Margin, Capital and Balance [Re: dusktrader] #427560
08/09/13 13:45
08/09/13 13:45
Joined: Apr 2013
Posts: 57
3
3DCat Offline
Junior Member
3DCat  Offline
Junior Member
3

Joined: Apr 2013
Posts: 57
Thank you, i overlooked that little "and/or".
But how does it behave? Zorro can calculate Lots from both variables. Am i right that it chooses the one with the lower calculated Lotsize?
eg, i have Stoploss distance of 10 per Lot, Margincost of 20, and Risk set to 100, Margin set to 40(Hypothetically).

Will it trade 10 Lots(Risk) or 2 Lots(Margin)?

Re: Understanding Lots, Margin, Capital and Balance [Re: 3DCat] #427567
08/09/13 14:51
08/09/13 14:51
Joined: Jul 2000
Posts: 27,935
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,935
Frankfurt
Yes, it chooses the lowest number of lots from Margin and Risk.


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1