Created
October 22, 2024 15:40
-
-
Save ryanlowdermilk/1ab1fe6af84daaed45653ab1ad7d04e2 to your computer and use it in GitHub Desktop.
A hotkey script for taking a Short position in DAS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $dailymaxloss = -500; | |
| $risk = 500; | |
| $volumeThreshold = 40000; | |
| $priceThreshold = 0.68; | |
| $930AM = 34200; | |
| $mytime = getsecond(); | |
| $safeEntry = LAST + $priceThreshold; | |
| $realized = GetAccountObj($account).Realized; | |
| if ($realized <= $dailymaxloss) { | |
| PlaySound("notsafe.wav", "Default", SHARE); | |
| MsgLog("[:::] Daily Max loss hit! Loss today is " + $realized); | |
| MsgBox("Daily Max loss hit! Loss today is " + $realized); | |
| } else { | |
| if (getsecond() >= $930AM) { | |
| if ($VOLUME >= $volumeThreshold ) { | |
| if (price >= $safeEntry) { | |
| CXL ALLSYMB; | |
| $sellprice=Bid; | |
| $mystop=price; | |
| $pricetostop=$mystop-$sellprice; | |
| $target=Bid-$pricetostop; | |
| $stophalf=(LAST+$mystop)/2; | |
| $amount=$risk/$pricetostop; | |
| SShare=$amount; | |
| Share=$amount; | |
| TogSShare; | |
| ROUTE="SMRTL"; | |
| Price=$sellprice; | |
| Price=ROUND2; | |
| TIF=DAY+; | |
| SELL=Send; | |
| TriggerOrder=RT:STOP STOPTYPE:RANGEMKT LowPrice:$target HighPrice:$mystop ACT:BUY QTY:POS TIF:DAY+; | |
| if (GetAccountObj($account).getposition(SYMBOL).share < 0) { | |
| FocusWindow MainChart; | |
| RemoveAllTrendlines; | |
| DrawHorzLineWithPrice($stophalf,color("gray")); | |
| } | |
| } else { | |
| PlaySound("notsafe.wav", "Default", SHARE); | |
| MsgLog("[:::] " + Symbol + " @ " + LAST + ". Risk to high. Bad stop. Stop set to " + price + " vs. " + $safeEntry); | |
| MsgBox("Bad stop. Recommended stop " + $safeEntry); | |
| } | |
| } else { | |
| PlaySound("notsafe.wav", "Default", SHARE); | |
| MsgLog("[:::] " + Symbol + " @ " + LAST + ". Not enough volume. Volume " + $VOLUME); | |
| } | |
| } else { | |
| PlaySound("notsafe.wav", "Default", SHARE); | |
| MsgLog("[:::] " + Symbol + " @ " + LAST + ". No short positions before 0930. Current seconds: " + getsecond()); | |
| MsgBox("No short positions pre-market."); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment