-
I’m linking and recommending this further refined SE version by strooth:
https://www.haasscripts.com/t/cmd-vpm-haasscript-version/Changes:
-Create a Position (thanks to Bunka (he already added it his version VirtualPositionCreationAndManagement_v2b)
-temporarily enabled Return blockuntil fixedto see how that goes..
more info and previous version:
https://www.haasscripts.com/t/ve-cmd-virtualpositionmanagementinputs/
Useful to create, adjust or close a position to match the non virtual: real position size (if not 0) on exchange.
If this has changed manually or otherwise And
You want to update a running HaasBot to ‘know’.. or ‘forget about it’….Clear /clean any residual Virtual Positions and prevent what is sometimes referred to as
“Ghost Orders” (Limit orders to close what is already gone on exchange opening new ‘ghost’ positions that your script (now considers as closed)) or trade amount errors instead. When you happen to know your script to occasionally gets residual old orders that you want to clearThis can occur for various reasons in or outside your script: latency, a server reboot or scripts frequently trading multiple ‘Unmanaged’ positions at a time ..
Forces of nature / acts of god, Murphy’s law etc all can make the virtual not match the ‘real’ [state of a position size if any.]
If still in doubt remember this for when you’d wish you called ghostbusters/=] or
typed VPM and included this simple tool for the job:
To clean what is not there to begin with..
If you don’t set a price to close a VP, your ROI will be off….
(It probably can’t hurt to have it in your scripts, for when you would find out you’d love it (*but use at your own discretion.))