[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Position Sizing



PureBytes Links

Trading Reference Links

Jody,

Tradestation evaluates code on EVERY BAR in the chart. Thus your code is
executed on every bar where the condition is true, not just after the last
winning trade is exited.

Therefore you should enclose these lines inside the condition(s) which cause
your system to exit a trade.

Regards,

Robert



-----Original Message-----
From: Jody Ellis [mailto:ellis_jody@xxxxxxxxxxx]
Sent: 11 July 2001 07:45
To: omega-list@xxxxxxxxxx
Subject: Position Sizing



I am trying to play around with an martingale type position sizing formula
that adds another contract with each winning trade. Below is the code I have
used and have tried many variations, but I cannot seem to get it to work.

The idea is once I have a loss, the num variable returns to 1 and starts
again. So, if I have a win, then num goes to 2 for the next trade. If I have
2 winners, num goes to 3 etc,etc. I want the system to increase with a new
contract with each consecutive win.

I have read many times that Anti-Martingale strategies work best, but I just
want to see the differences for myself. I have tried this on an S&P system
and after the first winner of 1 contract the system then buys amounts like
11, 76, 27 etc on the next trade. Can somebody help me out? Here's the code:

Variables: Num(1);

If PositionProfit(1) < 0 Then Num = 1;
If PositionProfit(1) > 0 Then Num = Num + 1;

Buy Num Contracts Blah Blah;

I have also tried this code but it still won’t count correctly:

Variables: Num(1);

If PositionProfit < 0 Then Num = 1;
If PositionProfit >= 0 Then Num = Num + 1;

Buy Num Contracts Blah Blah;

I have also tried setting the PositionProfit up as a variable and referring
to it, but still no joy. Here’s that attempt:

Variables: Num(1), PP(0);

PP = PositionProfit;

If PP < 0 Then Num = 1;
If PP >= 0 Then Num = Num + 1;

Buy Num Contracts Blah Blah;

Any ideas? Thanks.