At PineScript V5, Strategy.entry
has some quirks. Setting limit
, stop
, or both parameters will give you different results.
At least for V5, your answer in fact didn't give you a stop-limit. You get a market order with a simple stop loss at market. If you really want a stop-limit, probably you want to set stop
and limit
parameters.
Below, some explained examples for each case.
No limit
or stop
parameters
A simple market order.
strategy.entry(id = "Long", long = true)
limit
without stop
parameter
A simple Limit order. Placed to be executed when a advantageous price is reached.
strategy.entry(id = "Long", long = true, limit=high[1]+10)
stop
without limit
parameter
A Stop order. Which is kind of a limit order, but placed in a disadvantageous price.
strategy.entry(id = "Long", long = true, stop=high[1]+10)
Both stop
and limit
parameters
A market order with stop-limit stop loss.
strategy.entry(id = "Long", long = true, limit=high[1]+10, stop=high[1]+20)
This last one will result in a market order with a trigger for a Stop-Limit order. In other words, it placed and when stop
price is reached, a limit order at limit
price will be placed. It's possible the order could not be fulfilled.