Task One - Make a slow to trigger stop (anti stop hunt stop)
-
wait markprice < 23500, let x markprice, wait 8, if markprice < x-10, sell 30%possize, else, wait 8, if markprice < x-5, close all, else, wait 30, if markprice < x-10, close all, else, end
So you are using disposable variable for this one, we don't need it for anything else except this command. So we use let
, for let x markprice
. This sets x to the markprice once price breaks below 23500. It will stay at whatever the markprice was in that moment from that point on. We then wait 8 seconds. If the current markprice is under the recorded markprice we set earlier minus a further -$10, it'll reduce your position by 30%. Otherwise, it'll wait 8 seconds and reassess. Reassessment is if current markprice is under the x -$5, it'll close your position completely, otherwise wait 30 seconds. After 30 seconds has passed, if current markprice is under x -$10, close your position, otherwise end this command string.
So essentially here, and this is just for example purposes, we have created a stop that will not trigger immediately, but will assess the market conditions over 48 seconds, so if it's just a wick you won't be stopped out. But it will stop you out if price continues down. A lot of people use markprice for triggers on their stops for this purpose, this goes a step further than that, and just recreates what you are wanting in the first place.