I can not tell the computer when to exit. I am creating a mm model

39 Views Asked by At
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.

1

There are 1 best solutions below

2
On

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'