0

I am not see what I need with my strategy.exit order. Here is the the Entry and exit order.

strategy.entry("Enter Short 8", strategy.short, qty=8, limit=lastopen)
strategy.exit("Short Prof", from_entry="Enter Short 8", profit=25, stop=lastopen + 4 * syminfo.mintick)
            

What I want to do is have the entry set to the open of the previous bar. That value is in lastopen variable.For this example we are shorting. I have an if statement preceding this to check if the previous bar is an up or green bar. If so, I want 8 contracts with a limit order of the previous bar's open. To exit, I want to take profit when the current close is at least .25 below lastopen. I want my stop to be above, lastopen + 4 *.25, the entry. I am using the futures ES market, which follows the SPY 500 index. Each tick is .25. I am using Tradingview's strategy tester with a pine script. The script is looking at the last realtime bar and I have set the update on every tick to true. I am doing something wrong as these triggers are not firing as expected.

When the close is less than equal to lastopen - .25 the take profit order is not firing. It appears to close after a few cents. What am I not doing correctly?

Will
  • 1
  • 2

0 Answers0