count of bars
Forums › ProRealTime English forum › ProOrder support › count of bars
- This topic has 15 replies, 3 voices, and was last updated 7 years ago by
Vonasi.
-
-
07/17/2018 at 7:03 AM #76105
hi guys,
i want to count the bars – and exit the market after 16 days /bars.
i know there is
123if onmarket and barindex-tradeindex > 15 thensell at marketendifbut i dont like to use barindex – because it depends on when u started a system or on the chart.
so i am looking for another try like
12345N=summation[15]if onmarket and n>15 thensell at marketendifis this possible? i just want to exit after x days/bars
07/17/2018 at 8:20 AM #76107I do not understand what the issue is with:
1if onmarket and barindex-tradeindex > 15 then….as it works perfectly in all situations for counting how many bars you have been on the market for. When the chart data started is irrelevant as BARINDEX and TRADEINDEX are just a filing system that gives a bar a numerical label.
I guess you could try something like:
123if summation[15](countofposition <> 0) = 15 thensell at marketendifNot tested and as I say I do not understand why you are trying to re-invent the wheel.
1 user thanked author for this post.
07/17/2018 at 5:57 PM #76157@vonasi – thx for ur quick reply i really thank u!
12345678910// Bedingungen zum Ausstieg von Short-Positionenyy1 = (close < average[10](close)-std[20](close)) // hier ggf. auch + und close[1]yy2 = (close < close[1])yy3 = barindex-tradeindex >= 15yy4 = positionperf <= 0yy = yy1 and yy2 or yy3 or yy4if yy thenexitshort at marketendifi did that at yy3 – but now i get 16 bars – so thats what i meant…. 🙁
07/17/2018 at 6:01 PM #7616307/17/2018 at 6:07 PM #76165hmm thx think thats right – automated trading is at close.. so could be the 16th to exit….
1yy4 = positionperf(close[1]) <= -1do u think thats right? i want to say:
if the profit of the open trade is negative since the bar before, system has to sell this order…
07/17/2018 at 6:07 PM #76166mmo_vienna, your code
12345N=summation[15]if onmarket and n>15 thensell at marketendifwill never be true (also, SUMMATION lacks what it has to SUM) since N will never be > 15, as you wrote 15 within brackets!
07/17/2018 at 6:08 PM #76167yes thats true.. tried some things but dont work :S
07/17/2018 at 6:13 PM #76168if the profit of the open trade is negative since the bar before, system has to sell this order…
1yy4 = close[1] > positionprice and close < close[1]1 user thanked author for this post.
07/17/2018 at 6:17 PM #76169thx for this!
but i get negative results :/
07/17/2018 at 6:23 PM #76171but i get negative results :/
You provide the questions – the answers can not always be guaranteed to be profitable! 🙂
07/17/2018 at 6:25 PM #76172haha yes but shouldn’t the order been closed when i have this code? if profit ist negative then…
07/17/2018 at 6:43 PM #7617307/17/2018 at 6:46 PM #76175so if i want to say if order is negative and stays negative the next bar i have to write it in a loop right?
07/17/2018 at 6:55 PM #7617607/17/2018 at 7:03 PM #76177i want to say:
if my open order is negative -€ since 2 bars or more than -100€ the system must sell this order and buy in other direction
-
AuthorPosts
Find exclusive trading pro-tools on