1 alert per strategy. That's it. That's all you get. Knowing what can be used and where can be a little overwhelming.
Trust us, we have been doing this for years, and although this article should have been done weeks ago, we kept getting caught up in the scripts or paths that can be taken. There are all kinds of new functions we have accress to, yet we're still stuck with a single alert...
The most important parameter that will need to be addressed is Autoview's book parameter [b=]. This is curcial to know whether you're buying or selling. For this, we are going to always use the {{strategy.order.comment}} call in our alerts.
When you create your trigger within Pine, albeit strategy.entry, order, exit or close, you can add a comment. This allows you to set specific parameters such as the [b=] or [c=]. Below is a long open and a long close comment.
strategy.entry("Buy", 1, limit=f7, comment="b=long")
strategy.exit("Sell", "Buy", limit=ftp, stop=fsl, comment="b=long c=position")
We then just need to specifically call these comments to set our books within the alert.
Now, when the appropriate alert triggers, Autoview will open and close respectively.
Of course, this is not likely all you're going to want or need in your alert. There are lots of options for each parameter so we will first provide an example of a command with the comment, built-in values and some custom ones.
e={{exchange}} s={{ticker}} {{strategy.order.comment}} t=market q={{strategy.order.contracts}} ftp={{plot("Take-Profit")}} fsl={{plot("Stop-Loss")}} d=1
As you can see, this would have set all the parameters above for me except for the t=market. If I were to be switching between market and limit, this is something that could be included within the comment for more precision.
Now, on Bitmex you can not place your take-profit and stop-loss at the same time that you open, so we typically need a few commands.
e={{exchange}} s={{ticker}} {{strategy.order.comment}} t=market q={{strategy.order.contracts}} ftp={{plot("Take-Profit")}} fsl={{plot("Stop-Loss")}} d=1
delay=1
e={{exchange}} s={{ticker}} {{strategy.order.comment}} c=position t=market ftp={{plot("Take-Profit")}} d=1
e={{exchange}} s={{ticker}} {{strategy.order.comment}} c=position t=market fsl={{plot("Stop-Loss")}} d=1
Buit-in parmaters used above are:
- e={{exchange}}
- s={{ticker}}
- {{strategy.order.comment}}
- q={{strategy.order.contracts}}
Custom plots used for the advanced orders.
- ftp={{plot("Take-Profit")}}
- fsl={{plot("Stop-Loss")}}
In Pine:
percentage = input(true, "Percentage Values for TP/SL")
ftpInput = input(0.1, "Fixed Take Profit")
fslInput = input(0.1, "Fixed Stop Loss")
if percentage
ftpInput := ftpInput / 100
fslInput := fslInput / 100
ftp = close + close * ftpInput
fsl = close - close * fslInput
plot(ftp, "Take-Profit")
plot(fsl, "Stop-Loss")
Although we no longer need to convert our strategies into studies, we still have a little bit of leg work to do to get everything running as expected.
If you have any specific scenarios you'd like to see examples of, or have any questions, please don't hesitate to contact us directly via support@autoview.with.pink or drop by our community discord where there are others willing and able to help, and of course, we pop by there to when we can.
Comments
0 comments
Article is closed for comments.