Hello, can’t we use the buy orders we wrote in tradingview on this platform? For example, in my strategy, buy and sell entry and exit values change in each equation. But I cannot write anything in the message field other than the parameters accepted by this platform. That is, when a position is closed, I want to give different entry and exit values of the other position, but I cannot do it. In other words, how can I assign the values from the strategy without writing sl or tp in the alarm section? I hope I could explain.
Hello @baracuda
Yes, we allow custom variable fetching from your strategy using the TradingView placeholders. For example, if you entered BUY EURUSD P={{close}}, the alert will be triggered with the closing price of the candle.
Similarly, you can fetch the TP/SL using the placeholders. You need to reference the points where your values are plotted.
For example, I have this strategy that the developer created with TP and SL. He made it so that the SL and TP were generated automatically and plotted in a plot TP and SL and gave me the points for this. This is how I in turn automate it {{strategy.market_position}} {{ticker}} tp={{plot(“TP”)}} sl={{plot(“SL”)}} q=0.5%
This can automatically pick my TP and SL.
Tash.
thank you for the answer. I’m sorry to make you confused, but I have 1 more question.
I set an alarm in my strategy and both buying and selling transactions are carried out with this alarm. {{strategy.order.action}} BTCUSDT Q=45% L=75 A=USDM this is how I put my strategy on alert. However, when a close or exit order comes from my strategy, it tries to trade within this alarm. I get this error because there are no values like A L Q for close. This strategy statement gives an error when the exit command comes while this purchase or sale is running.
FAILED
InvalidOrder binanceusdm amount of BTC/USDT:USDT must be greater than minimum amount precision of 3 [quantity: 0.00036963486539540505 I get an error like this. Because there is a Q value and an L value in my alarm code, but when the exit command comes, these commands fail. I hope I was able to explain how we can solve this problem.
and if the TP SL values you specify here are our values and variables coming from the strategy, we specify them with variable names such as profit = 2, loss = 5 in the pine script. According to the example you gave, should we use the variable names there? so {{strategy.market_position}} {{ticker}} tp={{plot(“TP”)}} sl={{plot(“SL”)}} q=0.5% your profit or loss into the {} you specified here Should we write it as tp={{plot(“profit”)}}
Hello there,
This is happening because you are using the wrong code for a strategy with a close command. We use {{strategy.market_position}} which enables the close command to be generated as a close command.
{{strategy.order.action}} will only give buy and sell only.
For tp and sl, consult the developers with the example I shared above to help correctly reference the TP/SL.
Tash
Hi, I couldn’t translate your last words exactly. Do I need help from other developers?
And is there a help page or code explanation page that contains all of these commands? https://tradingview.to/binance The codes on this page are very inadequate. And for a strategy that includes both buy and sell and close, what should be an alarm code that will send the tp and sl values via tradingview.com with an alarm. So I would be very happy if you could show me a single line of code. My strategy is trading. It determines tp and sl values and closes. {{strategy.order.action}} What should I write next to such a code?
hi
I write the following code in the message field for my strategy that sends both buy and sell orders.
{{strategy.market_position}} BTCUSDT Q=40% sl=0.35% tp=0.75% L=50 A=USDM
There is no problem with buying and selling, but I get an error like this in close orders, how can I fix it?
flat BTCUSDT Q=40% sl=0.35% tp=0.75% L=50 A=USDM
FAILED OperationRejected binanceusdm {“code”:-4164,“msg”:“Order’s notional must be no smaller than 100 (unless you choose reduce only).”}
In this case, we use the CQ parameter, which is the closing quantity.
In your code, insert CQ=100%.
For example, {{strategy.market_position}} BTCUSDT Q=40% CQ=100% sl=0.35% tp=0.75% L=50 A=USDM