Search found 3 matches

Go to advanced search

by RobAgrees
Fri Mar 17, 2023 8:32 pm
Forum: Pine Script Q&A
Topic: Moving Stop Loss
Replies: 2
Views: 3367
 
Jump to post

Re: Moving Stop Loss

Because your entry conditions have your exit conditions nested in them. Your code enters a trade the first time, but then exits the if flow because it doesn't get a sell signal until future bars. On the future bars, with an open position, strategy.opentrades == 1, so it doesn't go through the if log...
by RobAgrees
Fri Mar 17, 2023 8:25 pm
Forum: Pine Script Q&A
Topic: How to trigger alerts in real time (calc_on_every_tick on)
Replies: 6
Views: 6098
 
Jump to post

Re: How to trigger alerts in real time (calc_on_every_tick on)

I believe it's because you are using var when initializing your variables, which doesn't update the value intrabar, hence it still orders on close because that's when the next value in the series is updated. You'll want to use varip instead . But note, it can't be backtested accurately because the i...
by RobAgrees
Fri Mar 17, 2023 8:18 pm
Forum: Pine Script Q&A
Topic: Function not plotting as intended. PLEASE HELP.
Replies: 8
Views: 7125
 
Jump to post

Re: Function not plotting as intended. PLEASE HELP.

Not sure what the issue was. I reformatted the script and it works on every timeframe and asset I tried https://www.tradingview.com/x/lFlr28Ep/ //@version=5 indicator('Test Script', overlay=true) Timeframe = input.timeframe('60') i_T26 = input.symbol('NYSE:DINO') f_strategy() => test = close > open*...

Go to advanced search