I'm not a huge fan of buying stock by shares; I would rather put on equally sized positions in dollars and then win/lose a certain % or SD on my trade.
In a certain way -- in fully discretionary trading -- this is fairly easy to do, although discipline can be a factor.
When I trade automated, I like to set up a formula for my position sizing and risk management before I begin running my strategies for the day.
2 questions arise:
1. I have created a user defined method to convert my position size from shares into dollars. So if I want to trade 30,000 dollar lots in most stocks for the day, I simply calculate:
$30,000 / Close[0] and then round the number of shares to the nearest hundred. It looks like this in theory:
double dollarsToShares(int dollars, double stockprice)
{
double shareCount = Math.Floor((dollars/stockprice)/100)*100;
return shareCount;
}
I would then use:
EnterLong(shareCount, basicLongStrategy); or
EnterShort(shareCount, basicShortStrategy); .
Unfortunately I am having trouble using the calc in my EnterCommands because it is defined as a double, while I believe the EnterCommands require Int. I am sure that there is an easy fix for this, I just haven't found it yet.
2. In the interest of becoming more disciplined, I would like to code a line or two that says: "If Position Size = Max Position Size, reject any/all attempts to enter opening orders in that specific security. Basically, I find that my success rate goes way down when I attempt to fight positions by sizing up as they go against me. I recognize that this is also probably easy to code, but would appreciate if someone could point me in the right direction of the documentation I might refer to in order to accomplish this. I am also wondering if it will be easy/hard to override such piece of code, which in general, I do not want to do, ever.
Thanks in advance for any help and regards to all.
Comment