Jump to content

Recommended Posts

I am looking for a TriggerOrder, i want this to be first order doubles my position and i got that to work now the follow up:

TriggerOrder=RT:STOP STOPTYPE:LIMIT PX:StopPrice-0.12 ACT:SELL STOPPRICE:AvgCost-25/Pos QTY:Pos TIF:DAY+;

I suspect i can't do AvgCost -25/Pos all in one math equation? I'm not proficient enough with the writing of TriggerOrders to reverse engineer my solution. Do I have to set a variable for my $25/Pos to then set another variable as average cost to then get to STOPPRICE: varible A - varible B?

 

Ultimately my goal is double my position and then set a new stoploss at a dollar risk below average cost, but also would like to know a little more of how the triggerorder scripts work/ written.    

Share this post


Link to post
Share on other sites

After talking to Das Support AvgCost if I followed correctly cannot be in an equation. Or as they stated cannot be used as a defined point? So support couldn't follow what i was asking. As in Kyle's hotkeys STOPPRICE:AvgCost sets STOPPRICE as a defined variable from the function in DAS of AvgCost. If I understand what I'm trying to reverse engineer here. So move farther left of the TriggerOrder Script PX:StopPrice-0.12 I can set that as PX:StopPrice-25/Pos but I will still run into the program doing math will it go (StopPrice-25) / Pos or in order of operations 25/Pos then subtract that from the calculated value of AvgCost. I have never seen any scripts written with parentheses in them and don't know how DAS treats the scripts and also don't know if i can define another variable or which storable variables I may use for this. So I switched the STOPPRICE back and dropped the-0.12 to -25/Pos. Will test tomorrow and see what happenes. 

 

TriggerOrder=RT:STOP STOPTYPE:LIMIT PX:StopPrice-25/Pos ACT:SELL STOPPRICE:AvgCost QTY:Pos TIF:DAY+;

Share this post


Link to post
Share on other sites

interesting, when do you want this order to be triggered? at specific R or at specific place on the chart?

this is the free roll hotkey which could be an inspiration maybe. what it does is that once the price action moves in your direction you double click where you want your new stop to be and it calculates the size so your risk is the difference in current price and the stop loss you clicked. so it will add-up to the position while you risk only the price action move and not your money.

: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=LIMIT;BUY=SEND;DefShare=10; TriggerOrder=RT:STOP STOPTYPE:MARKET PX:StopPrice ACT:SELL STOPPRICE:StopPrice QTY:Pos TIF:DAY+;

 

Share this post


Link to post
Share on other sites

Thanks for your reply, 

 

Not at an R, so I enter a position using Kyle's hotkey ay 49% on my BP. Currently running SIM with these at a dollar set risk amount. I also may enter up to a second position using Kyle's Hotkey. When this happens both those orders set a stoploss with a triggered order that runs and becomes  an order. So I have a calculated risk in both trades. Also I now have positions with AvgCosts in the position window. And stop orders set. Note I also do this well below my current BP so in the future I may learn that I'm not using this to its full scale and will never have the room left in my BP to be flexible like I think I want.

To then manage these farther I want to then add in assuming there is buying power left I have a hotkey that doubles my position, all of these hotkeys note I have Longs and shorts for:

ROUTE=SMRTL;Price=Ask+0.06 ;Share=Pos;TIF=DAY+;BUY=Send; 

Then after this I am working on a trigger order to set another stop at the same risk amount.

I.E. the math would be Stopprice = [AvgCost - (dollarrisk/Position)] Round to 2 places

So after talking with DAS support yesterday I have been enlightened to STOPPRICE=AvgCost can't be in a math formula. Now here is where my knowledge limits me. When writing scripts specifically now TriggerOrders or any script do they when defining a value in the montage for Price or Share follow math order of operations? 

What user defined variables are open that I can assign a value to? I.E. Kyle uses SShare I believe

In the TriggerOrder I posted STOPPRICE is set to the value of AvgCost then earlier in the script STOPPRICE has 0.12 subtracted from it.

TriggerOrder=RT:STOP STOPTYPE:LIMIT PX:StopPrice-0.12 ACT:SELL STOPPRICE:AvgCost QTY:Pos TIF:DAY+;

Do I need STOPPRICE:AvgCost then another SSTOPPRICE:STOPPRICE-25/Pos Then another DefSTOPPRICE:SSTOPPRICERound2 and finally PX:DefSTOPPRICE to get the value calculated and loaded into where I want it to go?

Does this explain a little more of what I'm shooting for and the limits of my knowledge here?

Share this post


Link to post
Share on other sites

to make it more simple take out the BP out of the equation and test it with $10 static risk first. BP counts are know to be inconsistent anyway by the design already.

what i dont like about trigger orders you described is that you can't attach stop loss order to them. and if you do it later it is not a one cancels another order type so if the price does not reach your trigger point you can be stopped or open a short position sooner then it can go your way and trigger the primary intention order. see the logical problem here? Maybe someone will prove me wrong but that is my understanding of this problem.

so i rather recomend you to do the entries manually and let the stop loss being automatically counted and attached to your manual triggered order. If your use case does not allow your presence or watching the stock for the entry, i am not sure if it can be done. But Kyle would be the best person to ask 🙂

if i double my position i do it always with the same hotkey i am entering a position with a new stop (can be the same or changed) and just cancel the previous stop loss order before i double or after i double.

Edited by peterB

Share this post


Link to post
Share on other sites

FYI

TriggerOrder=RT:STOP STOPTYPE:LIMIT PX:StopPrice-25/Pos ACT:SELL STOPPRICE:AvgCost QTY:Pos TIF:DAY+;

Did not trigger an order as I wanted

Share this post


Link to post
Share on other sites

make sure your montage style is set to stop order style

image.png.5925093c6e6436c5529c12f3e83a8b6d.png

Edited by peterB

Share this post


Link to post
Share on other sites

Thank you peterB, yes it is. I am using Kyle's Hotkey to enter into a position initially.

So I have decided to go and create a order entry hotkey first to do this and then try to write it to be a trigger order after I have a order first.

 

I believe I need to start here:

DefShare=25/Pos; DefShare=Round2; Price=AvgCost; Price=Round2; Stoploss=Price-DefShare

If I followed Kyle's info correct DefShare, SShare and Share are INT (Used as a temporary variable for storage) with SShare as unassigned.

although to be honest I don't follow INT? I do get the temporary variable this is what I am looking for.

Later he talks about TogSShare to release it I don't follow what is happening there so I will attempt to stay away from SShare.

This script will get the math done I think and now just add where to assign the numbers into the montage for the order.

Share this post


Link to post
Share on other sites

Update to this topic, I sent a message to Kyle 2 days ago, waiting for a response.

 

So I think INT means integer meaning a positive whole value. I need a value with 2 decimal places so DefShare, SShare and Share will not work for storing and computing the values I am looking for.

 

So I next went to test the parts of a script I can build and find writable values. I looked at LowPrice and HighPrice in a range script. tried:

 

LowPrice=Avgcost; Price=LowPrice

 

but get an error: Stop order type is not Range, can not set low price

 

next tried DefShare=Pos; Price=AvgCost-25/DefShare

 

and got error: Script:invalid price tried this with 10 shares AvgCost 28.93

 

so to test how it computes the math I could have gotten 28.93-25/10 being 26.43 or 0.393

 

Next tried DefShare=Pos; Price=AvgCost-DefShare

 

And got error: Script:invalid price

 

So next I tried changed my position to 1 share DefShare=Pos; Price=AvgCost-1 worked however

running DefShare=Pos; Price=AvgCost-DefShare got error invalid price

 

will review how Kyle uses price and shares in combination in his scripts

Share this post


Link to post
Share on other sites

Tried Price=Price-1*0.4; and found the scripts don't follow math order of operations they do the math in the order written and adding parentheses gets an error invalid operator . 

 

Still can not get a share INT into a price variable calculation. This may be limited by the program.

Edited by jmills8175

Share this post


Link to post
Share on other sites

Emailed DAS Support again.

Got this back to try:

Share=Pos;Price=25/Pos;Price=Ask-Price;Price=Round2

Gets invalid price also. Was ready to quite this and then tested this script:

Share=1;Price=AvgCost-Share

This works, I suspect something from Kyle29's hotkey on my entry is left loaded and screwing this up. This shows you can get Share into a calculation for Price.

Share this post


Link to post
Share on other sites

Got this to work: Share=Pos; Price=25/Share; Price=AvgCost-Price; Price=Round2; ROUTE=STOP; StopType=Market;StopPrice=Price ; Share=Pos; TIF=DAY+; SELL=Send;

25 is the dollars of risk you are willing to accept with this stoploss.

So why work this out? With using Kyle29's Hotkey by dollars of risk you can get into a position and set the risk by clicking on the chart then the systems calculates for you the number of shares you should be in . Then after the trade moves the direction you want I add to my position in a ratio. Could be 2x position or I could use 0.75x position. Andrew is adding in at 0.10x position. Then this Hotkey will move the stop up to and average cost for this position minus the risk in dollars you are willing to accept. I set this to half my original risk.

So dynamically calculate shares to be in then add to position and let the system move your stoploss .

I use 0.75 so my system is buy in then add to 0.75x position and then add to again o.75x position. it looks like 100 shares add 75 for 175 shares in position then add again

131 shares for a total position 306shares. Then I scale out at 33% second out is 50% and last is 100% so my steps out are 1/3 with 2/3 left then 50% out is another 1/3 out

and then the last is 100% or final 1/3.

I set my keyboard up with 2 keys long into a position and 2 keys into a short

Then 3 keys out of a long and 3 keys out of a short

I have played around with the idea of setting the partial out as 2 keys also one being out 43% and 100% but the 33% 50% and 100% is a straight line curve by shares decreasing. at 42% it is largest portion out first then small to medium. looking 306 shares first out 129 then 74 and last portion 103.

 

All of this gives me a technical pattern to trade and the system measures my risk. I can then focus now on developing my trade book and know if I'm not gaining it is because I'm not reading the charts entering and exiting well or picking good tickers to trade. I set a 1% risk with a 2% daily goal or 250 daily risk maximum and a daily goal of $500. I will set a $125 risk per trade meaning each day i can lose at 2 trades then be done for the day. Also a single trade to daily goal is a 4:1R but 2 good trades at 2:1R gets me there. Generally i miss the daily goal getting only 2.8:1R but its just a goal. Currently I have a very small data sample for this at only 3 weeks with an average of 3 days a week because of my job. Having the hotkey scripts now will help improve things.

 

I will post my set of scripts later in the new week.

Share this post


Link to post
Share on other sites

maybe post a video on what you do with this as i am completely lost from your description 🙂

Share this post


Link to post
Share on other sites

CCL Long Orb trade today. Kyle's hotkey got me in 104 shares at $29.28 my risk is $25 while I'm testing these in sim so the stoploss would be $0.24 plus the

40.04 slip I added into his system - so $29.

Next I added in on the second 2min bar at double my shares to 208 total, my hotkey moves the stoploss to $12 risk or AvgCost -0.057 rounded 2 decimals - so 29.4=AvgCost  or 29.4-0.06=29.36

I partialed 33% or sold 68 shares at 29.66 net $17.68 and this hotkey also sets stoploss to break even on rest of shares.

Then I added back in but this is a double share key so buy 140 shares at $29.55 then set new stoploss at again $12 risk at $29.43

Then partialed half my position at $29.76 then the last of my position at $29.78 for a net gain $100.28 and max risk of $25 at anyone time for a 4r trade.

Does this help demonstrate my system?

CCL15min3.15.2021.jpg

CCL3.15.2021.jpg

Share this post


Link to post
Share on other sites

First Entry Hotkey:

$25 risk Long with Stoploss Trigger -

StopPrice=Price-0.01;DefShare=BP*0.49;Price=Ask-Price+0.01;SShare=25/Price;Share=DefShare-SShare;DefShare=DefShare+SShare;SShare=Share;Sshare=DefShare-SShare;Share=0.5*SShare;TogSShare;ROUTE=LIMIT;Price= Ask+0.06;TIF=DAY+;BUY=Send;DefShare=1000;TriggerOrder=RT:STOP STOPTYPE:LIMIT PX:StopPrice-0.12 ACT:SELL STOPPRICE:StopPrice QTY:Pos TIF:DAY+

$25 risk Short with Stoploss Trigger -

StopPrice=Price+0.01;DefShare=BP*0.49;Price=Price-Bid+0.01;SShare=25/Price;Share=DefShare-SShare;DefShare=DefShare+SShare;SShare=Share;Sshare=DefShare-SShare;Share=0.5*SShare;TogSShare;ROUTE=LIMIT;Price=Bid-0.06;TIF=DAY+;SELL=Send;DefShare=1000;TriggerOrder=RT:STOP STOPTYPE:LIMIT PX:StopPrice+0.12 ACT:BUY STOPPRICE:StopPrice QTY:Pos TIF:DAY+;

First entry hotkeys can be reviewed and setup from Kyle's hotkeys. I'm currently testing with small risk of $25

Add into hotkey:

Double Position Long -

CXL ALLSYMB;ROUTE=SMRTL;Price=Ask+0.12;Share=Pos;TIF=DAY+;BUY=Send;Price=12/Share;Price=AvgCost-Price;TriggerOrder=RT:STOP STOPTYPE:MARKET STOPPRICE:Price ACT:SELL QTY:POS TIF:DAY+

Double Position Short -

CXL ALLSYMB;ROUTE=SMRTL;Price=Bid-0.12;Share=Pos;TIF=DAY+;SELL=Send;Price=12/Share;Price=AvgCost+ Price;TriggerOrder=RT:STOP STOPTYPE:MARKET STOPPRICE:Price ACT:BUY QTY:POS TIF:DAY+

This doubles your position and then sets a stoploss with $12 risk and they cancel the previous stoploss orders for the ticker you are trading. Note there is a chance if you flip to another ticker while the triggerorder has not fired the stoploss may get screwed up. The add to order must fill and the triggerorder must fire while trading to work properly before changing something in the montage.

Edited by jmills8175

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.