0

I apologize, I know this would be a super simple fix but I am new to coding/pine script and have no idea what I'm doing but trying to learn.

I am trying to make a script that takes a trade at a specific time of the day (everyday), on a specific TF, in a specific direction depending on the candle close of the previous candle (long if downclose candle/short if upclose candle), with a set proffit/loss in pips.

The code below is what I've come up with, it seems to be working on the chart, but in the "List of Trades" tab, they're all coming up as losses, every one of them (see Screenshots for example).

Can anyone help me, greatly appreciated?

//@version=5
strategy("My strategy", overlay=true, margin_long=0, margin_short=0)

trigger_m = 0
trigger_h = 19

is_trigger_bar = (hour == trigger_h) and (minute == trigger_m)

is_buy  = is_trigger_bar and open > close
is_sell = is_trigger_bar and close > open


if (is_buy)
    strategy.entry("Long", strategy.long)

if (is_sell)
    strategy.entry("Short", strategy.short)

strategy.exit("exit", loss = 100, profit = 500)

Winning Trade Example

The above trade in the results showing as a loss

More examples of winning trades coming up as losses

I'm assuming it has something to do with how i am exiting the positions?

Sam
  • 1
  • 1

0 Answers0