Jump to content
Balazs Horvath

Issue with “Adding to a winning position”

Recommended Posts

Hi,

I have an issue with the following script which comes from the DAS video series:

CXL ALLSYMB;StopPrice = Price;Share=Price*100;Price=AvgCost;SShare=Price*100;Share=Share-SShare;Price=Share;Price=Share/100;Share=Pos * Price;Price=Ask-StopPrice;SShare=Share / Price;DefShare=BP*0.97;Share=DefShare-SShare;DefShare=DefShare+SShare;SShare=Share;SShare=DefShare-SShare;Share=0.5*SShare;Price=Ask+0.05;TogSShare;TIF=DAY+;ROUTE=SMRTL;BUY=SEND;DefShare=10; TriggerOrder=RT:STOP STOPTYPE:MARKET PX:StopPrice ACT:SELL STOPPRICE:StopPrice QTY:Pos TIF:DAY+;
 

It calculates the number of shares and risk perfectly fine, my only problem is with the set condition of capping the position size of 97% of the Buying Power. Actually I modified it to 60%, but when I use the script, every time my unrealized profit allows to buy more shares than the capping, the script doesn’t work properly as it ignores the cap and I end up having a much larger position than 60% of my buying power. It just ignores this cap.

 

Has anyone experienced the same? Any solution for that?

Share this post


Link to post
Share on other sites

it is 60% of the current BP so if you still have some BP on the 2nd key press it will use the 60% of the rest and add

a true BP check for the first key press looks like this
 

$myBP=5000;
$want=$risk/$pricetostop;
if ($myBP<=$want*LAST)
{
$amount=round($myBP*0.97/LAST,0)-1;
}
else
{
$amount=$want;
}

for the add it is more complicated  

for more modern hotkeys go here

Edited by peterB

Share this post


Link to post
Share on other sites

Thanks Peter but here it is what I dont understand: I reset my account size and BP to $60,000 (I used the DEMO version and in this case Replay mode) and set the cap to 0,99 both for my first long entry and the second adding entry (I use "Equalized Risk" script for going long (and short also) and the above mentioned "Adding to winning position" scripts, both from the DAS video series). Below are the screenshots of the result. After adding to my position I ended up having 562 shares at $164 which gives a $92,000 position which is a way above my BP ($60,000). How is it possible? I have to add that I have reset my account just before taking this test trade, so maybe I have to wait one day for DAS to process this new setup? (My previous BP was $100,000 by default)

Sorry for bothering you with this staff, but it annoys me....

Thanks again for the previous answer, I will check out the links you have provided! 

image.thumb.png.b4eeb11c65bc485dcf6266d01bedeef7.png

image.thumb.png.b26a219055a76d78a68f7c02b7a47a12.png

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.