Long formula works perfectly. For short side I found that risk doubles everytime, I had declared custom name variables for other hotkeys maybe thats where my script is going wrong.
I added an if statement between
$TBR=$TBRLS-$TBRRS;
$TOP=$DRISK-$TBR;
these 2 lines.
if ($newstop>last)
{
$TBR=-$TBR;
}
I dont use this script to send orders but rather fill montage with correct order, now Im able to use same hotkey for both sides.
Thank you Peter most your free stuff was big help, free posts+das documentaion I was able to build custom scripts that only would be available through algo otherwise.
Thank you for your reply. Am I right to say that if I want to go LONG A STOCK and I have a $100 risk:
(a) First I DOUBLE CLICK ON CHART TO SELECT MY STOP
(b) Activate hotkey and the script will AUTOMATICALLY CALCULATE SHARE SIZE based on the $100 risk AND AUTOMATICALLY BUY THE NUMBER OF SHARES CALCULATED and AUTOMATICALLY SET STOPS based on $100 risk.
(c) As the trade moves in my favour I click on chart to select a new stop higher than my original stop, I ACTIVATE THE SAME HOTKEY and the script will AUTOMATICALLY CALCULATE SHARE SIZE based on the $100 risk AND AUTOMATICALLY BUY THE NUMBER OF SHARES CALCULATED and AUTOMATICALLY RE-SET STOPS based on $100 risk.
Is this how it works? It will use up whatever is in my buying power to buy the automatically calculated number of shares required for $100 risk?
It will also use up whatever is in my buying power TO ADD the automatically calculated number of shares required for $100 risk when I wish to scale into a winning trade?
If I understand correctly it works like the free roll hotkey from your post (DAS Trader Advanced Hotkeys part 2), the stop is first manually set on the chart via clicking mouse for setting initial stop and then for setting new stop to scale into a winning position, the new stop is again manually set on the chart via clicking mouse a second time. Am I correct? Thank you.
coming from part 35, there is a correct math formula to calculate the adding size, I wrote my code by my own and tested hundreds of times and it's no problem. I did a careful look into your code, and found your math formula used a wrong variable and thus flawed. Since I'm not a subscriber I can't DM you, so I'll leave it here and hope you can see:
for example adding long position, the correct math using your way should be
{RISK - (CURRENT POS * AVG PRICE - CURRENT POS * YOUR_NEW_STOP_PRICE}/{CURRENT PRICE - NEW STOP}
the difference is this YOUR_NEW_STOP_PRICE part, and the hotkey shall work again. hope it helps!
thank you! sometimes it needs just more eyes :) what was mind bending for me was the fact that once i reached the unrealized at the same value as the desired risk it zeored itself. i could not find the error in the formula implementation in the syntax so i thought it is a logical problem of some function limits reaching 0 and that there would be logically a new formula to use from the 0 point. i will edit both posts.
So if I understand correctly, this is very similar to the Free roll hotkey from part 2, but in free roll along with adding more we are moving stop loss to breakeven. In this case we are adding more but also specifying the new stop loss risk dollar amount (which is different than breakeven) . Can you please confirm.
I’m using a simple hotkey to add to a position while keeping the same risk. It works on the first add, but on the second and third adds, it doubles the risk each time.
For example, if I start with a position risk of $20, then add with the same $20 risk, the first add works correctly. But on the next adds, the risk increases to $40, then $80.
Is there anything I can do to fix this? My strategy is to systematically add to my position when it’s in my favor, maximize it, then sell everything. How can I cap the risk per add to keep it consistent each time?
Long formula works perfectly. For short side I found that risk doubles everytime, I had declared custom name variables for other hotkeys maybe thats where my script is going wrong.
I added an if statement between
$TBR=$TBRLS-$TBRRS;
$TOP=$DRISK-$TBR;
these 2 lines.
if ($newstop>last)
{
$TBR=-$TBR;
}
I dont use this script to send orders but rather fill montage with correct order, now Im able to use same hotkey for both sides.
Thank you Peter most your free stuff was big help, free posts+das documentaion I was able to build custom scripts that only would be available through algo otherwise.
Hi Peter, with this hotkey, do I
(1) FIRST KEY IN MANUALLY the initial share quantity in the montage window
(2) SECONDLY ACTIVATE THE HOT KEY and then the script the calculates the stops for me based on my risk?
Did I get the logic right? Thank you.
no, it calculates the risk from the first timw you use it. you can use it multiple times the same way - click to the chart to set the stop then press the hotkey. Also see the post https://open.substack.com/pub/traderpeter/p/das-trader-advanced-hotkeys-part-9b3?r=1wujo4&utm_campaign=post&utm_medium=web&showWelcomeOnShare=false
Thank you for your reply. Am I right to say that if I want to go LONG A STOCK and I have a $100 risk:
(a) First I DOUBLE CLICK ON CHART TO SELECT MY STOP
(b) Activate hotkey and the script will AUTOMATICALLY CALCULATE SHARE SIZE based on the $100 risk AND AUTOMATICALLY BUY THE NUMBER OF SHARES CALCULATED and AUTOMATICALLY SET STOPS based on $100 risk.
(c) As the trade moves in my favour I click on chart to select a new stop higher than my original stop, I ACTIVATE THE SAME HOTKEY and the script will AUTOMATICALLY CALCULATE SHARE SIZE based on the $100 risk AND AUTOMATICALLY BUY THE NUMBER OF SHARES CALCULATED and AUTOMATICALLY RE-SET STOPS based on $100 risk.
Is this how it works? It will use up whatever is in my buying power to buy the automatically calculated number of shares required for $100 risk?
It will also use up whatever is in my buying power TO ADD the automatically calculated number of shares required for $100 risk when I wish to scale into a winning trade?
If I understand correctly it works like the free roll hotkey from your post (DAS Trader Advanced Hotkeys part 2), the stop is first manually set on the chart via clicking mouse for setting initial stop and then for setting new stop to scale into a winning position, the new stop is again manually set on the chart via clicking mouse a second time. Am I correct? Thank you.
correct, it will check if your new stop falls within the criteria of not over reaching the risk by the set percentage
Hi Peter, I tried using the hotkey. It returned an error and it says:
Script: Invalid operator
and also
Error Invalid Shares!
have you enabled advanced hotkeys in the configuration?
Hi Peter,
coming from part 35, there is a correct math formula to calculate the adding size, I wrote my code by my own and tested hundreds of times and it's no problem. I did a careful look into your code, and found your math formula used a wrong variable and thus flawed. Since I'm not a subscriber I can't DM you, so I'll leave it here and hope you can see:
for example adding long position, the correct math using your way should be
{RISK - (CURRENT POS * AVG PRICE - CURRENT POS * YOUR_NEW_STOP_PRICE}/{CURRENT PRICE - NEW STOP}
the difference is this YOUR_NEW_STOP_PRICE part, and the hotkey shall work again. hope it helps!
thank you! sometimes it needs just more eyes :) what was mind bending for me was the fact that once i reached the unrealized at the same value as the desired risk it zeored itself. i could not find the error in the formula implementation in the syntax so i thought it is a logical problem of some function limits reaching 0 and that there would be logically a new formula to use from the 0 point. i will edit both posts.
Hello Peter,
So if I understand correctly, this is very similar to the Free roll hotkey from part 2, but in free roll along with adding more we are moving stop loss to breakeven. In this case we are adding more but also specifying the new stop loss risk dollar amount (which is different than breakeven) . Can you please confirm.
that is correct
Hi Peter,
I’m using a simple hotkey to add to a position while keeping the same risk. It works on the first add, but on the second and third adds, it doubles the risk each time.
For example, if I start with a position risk of $20, then add with the same $20 risk, the first add works correctly. But on the next adds, the risk increases to $40, then $80.
Is there anything I can do to fix this? My strategy is to systematically add to my position when it’s in my favor, maximize it, then sell everything. How can I cap the risk per add to keep it consistent each time?
Can you help with this?
but if i should guess one of the variables is not updated
No without touching the initial stop at all .
I’m using it in sim
i would need to retest it on monday to see it. if you have a video ornacreenshots of it that would help
Yes indeed
what hotkey is that?
The one on part 5 to add into position while keeping the same risk
are you using it in sim or live or replay?
Sim
are you tightening/moving the stop?
No
are you adding while the position goes to profit?
Indeed
How do you show only the line of the risk (in example 100 dollar risk) on average without any execution?
for this function see the advanced hotkeys 7 post from the series