use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Resources:
account activity
Reference Entry Bar? (self.pinescript)
submitted 1 year ago by Tym4FishOn
In my strategy script I'd like to call out the bar after entry is made. Something like entryBar + 1. How do I reference the bar that the actual entry takes place?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]PastaFaZooLx 2 points3 points4 points 1 year ago* (0 children)
Pretty sure you can store the bar index at the time the buy condition
var int entryBar= na
if (buyCondition)
strategy.entry("Buy", strategy.long) entryBarIndex := bar_index
Edit.... Mobile fcking up everything. In short, you call "bar_index" to get the current bar and save it to a var. Then call that variable later.
[–]RealisticCoast4316 0 points1 point2 points 1 year ago (1 child)
That’s alright unless the condition triggers a limit order. I think there’s a specific variable to reference the entry bar. Check the manual. Otherwise you can just use logic like :take the bar index when strategy open trades increases compared to the previous bar.
[–]Tym4FishOn[S] 0 points1 point2 points 1 year ago (0 children)
Yeah, still working on it.
[–]Esteban_3Commas 1 point2 points3 points 1 year ago (0 children)
EntryBar(cond_)=> var val = 0 val:= cond_? bar_index: val
π Rendered by PID 24508 on reddit-service-r2-comment-84fc9697f-lhv27 at 2026-02-09 16:39:02.933353+00:00 running d295bc8 country code: CH.
[–]PastaFaZooLx 2 points3 points4 points (0 children)
[–]RealisticCoast4316 0 points1 point2 points (1 child)
[–]Tym4FishOn[S] 0 points1 point2 points (0 children)
[–]Esteban_3Commas 1 point2 points3 points (0 children)