-3

I programmed a strategy with Pine but upon running it and looking at the list of executed trades in the Strategy Tester, the results are puzzling to me.

The first trade was a long position of 5 contracts bought at 103.067$ and hit its target of 103.427. So shouldn't the profit be 1.8$? (103.427 * 5) - (103.067 * 5). The amount I bought at minus the amount it was sold at? But the Strategy Tester lists a profit of 0.02$.

The second trade is I calculate the profit to be 1.73$. (104.024 * 5) - (103.678 * 5). But again the profit listed is completely different, at 0.02$.

I am not sure what I'm missing here, in how TradingView is calculating the profit?

Here is a screenshot of these trades in the strategy tester.

halfer
  • 19,824
  • 17
  • 99
  • 186

1 Answers1

0

The amount of profit or loss will depend on the order size you used. You can change it from

either default_qty_value=

strategy(default_qty_value=)

or qty=

strategy.entry(qty=)
bbnm
  • 1,034
  • 1
  • 4
  • 14
  • Sorry, I guess I wasn't clear in my post. But my default_qty_value was set to 5. Along with the default_qty_type is set to strategy.fixed. Which still unfortunately doesn't explain how it's coming up with it's profit number. Any ideas? – Happy Programmer Aug 21 '21 at 19:35
  • (103.427 * 5) - (103.067 * 5) = 1.8 JPY (not usd) 1.8/103.427 = 0.02 USD. You need to convert it into USD since the quote currency is JPY. – bbnm Aug 22 '21 at 07:10
  • Ahhh, ok. Thank makes a lot of sense. Thank you! – Happy Programmer Aug 23 '21 at 23:02
  • If it helped you, could you upvote it and mark it as the answer. Thank you. – bbnm Aug 24 '21 at 07:35