projecting calculated data on previous bar
Forums › ProRealTime English forum › ProBuilder support › projecting calculated data on previous bar
- This topic has 6 replies, 2 voices, and was last updated 8 years ago by Nicolas.
-
-
11/22/2016 at 7:35 PM #16966
Hello,
I’ve only just started with building my own indicators, I do like it a lot and the forum has helped me a lot while doing so. Currently I’ve run into a problem which is explained here below.
I do want to state that the code is far from finished, I’m setting R to equal 0 when the condition isn’t met, just for visualisation purposes!
I’m building an indicator based on pivot points, in my code I detect if a there is a bar which is higher than todays and the day before yesterdays bar. If the condition is true I want to project the Dhigh of the previous bar on the previous bar. (I’ve included the code beneath the text). When I project the data on my chart it is projected on the present bar rather than on the previous bar. So my question is how can I project the data on the previous bar?12345678910111213141516171819202122232425//variables//todays higha=Dhigh(0)//yesterdays highb=Dhigh(1)//day before yesterdayc=Dhigh(2)//variables in the function//R is price of pivot high//conditionscondition1=b>acondition2=b>c//functionIf condition1 and condition2 thenr=Dhigh(1)elser=0endif//resultReturn rI want to thank everyne for helping me outYours sincerelyBert
11/22/2016 at 7:54 PM #1696911/22/2016 at 8:10 PM #1697011/22/2016 at 10:01 PM #1697511/23/2016 at 4:58 PM #1702911/23/2016 at 6:31 PM #17043Hello, I tried to obtain the second order pivot points today, I want to mark them with another arrow in a different color. I ran into the following problem, I need a function which compares the different results rendered in the first function and picks out the highest one of a series. Until now I haven’t been able to come up with something thats works, are there any tips or could someone show me the way? I tried different functions found in the clossary on this website but nothing worked 🙁 I’ve included a picture of the code, the code of my previous question which is working fine and the selected data I want to extract from the first code and I want to represent on the graph. yours sincerely Bert
11/24/2016 at 9:11 AM #17062You need first to store the price value of each first function ‘ arrow:
12345if condition1 and condition2 thenval = Dhigh(1)......endifThen you’ll be able to access the “val” array of data in the past and make a comparison of which is the highest of the series within the last X periods:
1DRAWARROW(barindex,highest[20](val))Of course you’ll have to fetch the good barindex if you want to draw the red arrow at the exact candle in the past. You may find useful this code snippet that do this job (example 2 for drawing segment) : http://www.prorealcode.com/documentation/drawsegment/
-
AuthorPosts
Find exclusive trading pro-tools on