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

[amibroker] Re: Point value /position size and spreadbetting ... help please ...



PureBytes Links

Trading Reference Links

Dear CS - 

Thats a great help - I put it in and it came out with a "reasonable" 
positive value instead of an exponential negative value! By the way, 
I read the tutorial, but dont really understand how to use 
positionsize...

This is the new code: does it make sense?

NumContracts = 1;
E=Equity(1,-1);
MarginDeposit=1;
PositionSize=MarginDeposit;
PointValue = round(E*0.02/abs(C-AR));

(AR is a Mov.Av. value, a number of points above/below entry, and 
pointvalue has to be >1 for buy/short signal)

Also, refering to your reply, theres one thing I dont understand. 
You said: "Although you don't use contracts, you can bet (buy) more 
than one contract at a time to simulate different bet sizes and 
number of bets."

Does this mean I should keep pointvalue fixed, and vary 
numcontracts? Or will my fixed numcontracts and variable PointValue 
= round(E*0.02/abs(C-AR)) work? - I mean its already working, but 
can I trust the results, or is it "dodgy" programming likely to give 
me erroneous results?

Thanks again.


--- In amibroker@xxxxxxxxxxxxxxx, "CS" <csaxe@xxxx> wrote:
> Andrew,
> 
> Go to HELP in AB and read the tutorial: " Back-testing systems for 
futures contracts "
> 
> Although you don't use contracts, you can bet (buy) more than one 
contract at a time to simulate different bet sizes and number of 
bets.
> 
> To enter a constant point value for individual securities, go to 
SYMBOL > INFORMATION and see the entry for point value (bet size). 
The gain or loss will be multiplied by that value.
> 
> To control point value within your formula so it can be easily 
changed, use a PointValue= line.
> If you are betting 50 per point, try PointValue=50.
> 
> If you are doing one bet at PointValue=50, then buy one contract. 
Two contracts for two bets & etc.
> 
> Since you may not require any margin to place a bet, try 
MarginDeposit=1.
> Then, if you want to place 1 bet at PointValue=50, use 
PositionSize=MarginDeposit.
> To place 2 bets at PointValue=50, use PositionSize=2*MarginDeposit.
> 
> AB is wonderful at controlling positions and sizes. In the future 
TJ will include the ability to add to or liquidate existing 
positions. With the increasing popularity of single stock futures 
(not to mention those of us working commodities for years), TJ has 
wisely included some basic features for a growing segment of 
traders. I'm eager for more to come.
> 
> One final note:
> In -
> 
> Stoptrigger=MA(c,8);
> 
> stop=abs(c-stoptrigger);
> 
> Be sure to keep track of the point value for each point of gain or 
loss. If you set your stop by a difference in points and then 
compare it to your risk (0.02*Equity), that won't be accurate if you 
lose 50 pounds for every point the chart falls by.
> 
> -CS
>   ----- Original Message ----- 
>   From: Andrew Smith 
>   To: amibroker@xxxxxxxxxxxxxxx 
>   Sent: Wednesday, March 12, 2003 11:21 AM
>   Subject: [amibroker] Point value /position size and 
spreadbetting ... help please ...
> 
> 
>   Hi. Im stuck. I wonder if anyone can help...
> 
>   I've desgined a system that seems to work when I back test it as 
if I were buying/selling equities.
> 
>   However, I intend to operate it in a UK spreadbetting account. I 
dont know if this is available in the US, but basically, you decide 
on a "bet size" and bet in the direction you think a 
share/index/commodity will go. For example, lets say my system tells 
me to sell Microsoft, I can "bet" £1 - £50 per point (cents, pence 
etc) move. So if I bet £10 per point that MSFT will fall, and MSFT 
goes down 20 points, my account is credited with £200 ... and vice 
versa. Very simple. 
> 
>   Now, Im stuck on how to program this in AB using the position 
size, pointvalue and num contracts, etc. Can someone tell me if my 
logic is correct?
> 
>   1) Im expetcing to be in positions for days/weeks so I buy on 
close or open next day using a simple breakout system, so Im always 
above (long) or below (short) a moving average. Lets say Im going 
long and I decide the "points" I am prepared to lose will be the 
difference between my entry and an 8 day moving average: stop= abs
(c - MA(C,8));
> 
>   2) I will be risking 2% of my current equity on every operation: 
risk = round(0.02*Equity()); NOTE: Ive also tried setting risk to a 
fixed value, 200, and it still doesnt give meaningful results.
> 
>   3) As contracts per se dont exist, I set the numcontracts to 1. 
Im not sure this is correct, but it seems logical as bet size or 
pointvalue is variable. In futures you buy variable numbers of 
contracts and have a fixed point value, in spreadbetting you decide 
your own point value and dont "buy" any contracts at all. 
> 
>   4) The number of points to the stop must be less than the £ risk 
for the position to be affordable: for example, if the stop is 40 
points away, and my risk is calculated to be 200, my bet size will 
be 5. If I am stopped out right away, I will lose 5*40 = 200. If the 
stop is 300 points away, and my risk is 200, I cant enter that 
position (bet size<1 is not allowed by the system)
> 
>   5) Pointsvalue will be: pointvalue=round(risk/stop);
> 
>   6) I have absolutely NO idea how to use positionsize in this set 
up ... Do I need it? Should I set positionsize=-2?
> 
>   7) Futures mode is ON when I back test.
> 
>   8) I have also no idea how to set margindeposit, cos there isnt 
any "deposit" made, so I havent included it in the coding..
> 
>   Here is my final code:
> 
>   Stoptrigger=MA(c,8);
> 
>   Numcontracts=1;
>   E=Equity(1,-1);
> 
>   stop=abs(c-stoptrigger);
>   risk=0.02*E;
> 
>   buy=rule1 AND risk>stop;
>   short=rule2 AND risk>stop;
>   cover=rule3;
>   sell=rule4;
> 
>   pointvalue=round(risk/stop);
> 
>   This gives me exponential negative numbers in the backtest (and 
low positive numbers in the simple equity back test) ... so I think 
Im doing something wrong ... what coding have I missed out to be 
able to run the backtester OK?
> 
>   Any ideas anyone?
> 
>   Thanks ...
> 
>         Yahoo! Groups Sponsor 
>               ADVERTISEMENT
>              
>        
>        
> 
>   Send BUG REPORTS to bugs@xxxx
>   Send SUGGESTIONS to suggest@xxxx
>   -----------------------------------------
>   Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
>   (Web page: http://groups.yahoo.com/group/amiquote/messages/)
>   --------------------------------------------
>   Check group FAQ at: 
http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
> 
>   Your use of Yahoo! Groups is subject to the Yahoo! Terms of 
Service.


Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/