-1
Highestprice = ta.highest(close, 20)
LowestPrice = ta.lowest(close, 200)



Bid1exitCondition = state == 1 and close > fairValue and close < Highestprice[1]



if Bid1exitCondition
    strategy.close("Bid 1 Close")
    state:= 0

I was expecting an exit. I defined an exit in the bidexit condition. But nothing happened.

PaulB
  • 1,262
  • 1
  • 6
  • 17
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. – Community Nov 15 '22 at 12:36

1 Answers1

0

Your entry should be like this :

strategy.entry('long', strategy.long, qty=Q_Jetons, stop=limiteachat, limit=limiteachat)

Then your exit should be like this :

strategy.exit(id='Exit', from_entry="long", stop=StopLoss)

In your exit you need to specify the name of your entry in from_entry, here it is 'long'

G.Lebret
  • 2,826
  • 2
  • 16
  • 27
  • from_entry is not an argument for strategy.exit function in version 5 pinescript. I think there is a problem in this:- Bid1exitCondition = state == 1 and close > fairValue and close < Highestprice[1] – Ankit Thakur Nov 15 '22 at 21:38
  • @AnkitThakur : from_entry is an argument for strategy.exit in pinescript V5. You should see the manual page : https://www.tradingview.com/pine-script-reference/v5/#fun_strategy{dot}exit – G.Lebret Nov 17 '22 at 02:05