I want to return a value (variable) undefined before and after a given date
Forums › ProRealTime English forum › ProBuilder support › I want to return a value (variable) undefined before and after a given date
- This topic has 7 replies, 2 voices, and was last updated 1 year ago by robertogozzi.
-
-
01/23/2023 at 4:08 PM #208002
Hey there…
Here’s a challenge for you:-) Or maybe there is a simple solution to this?
I want to return a value (variable) which is undefined before and after a given date that i set my self. Basically, I want to set the start date of when the variable should start returning values and I want to set the end date of when the same variable should stop returning values.
How can this be coded? Probably quite simple huu?
Let me know
01/24/2023 at 10:13 AM #208048You can use UNDEFINED just for the first time, any subsequent assignement cannot be overwritten. So the solution is to reset the variable to 0, not to UNDEFINED:
1234567ONCE x = undefinedIF (Time >= 100000) AND (Time <= 120000) THENx = 1ELSEx = 0 //undefined won't work hereENDIFRETURN x01/24/2023 at 11:21 AM #208068Thanks for your answer! That means that UNDEFINED is probably not the right way to achieve what I want to achieve. Maybe it’s not possible at all.
I want to return a value from an indicator that I coded my self, but I don’t want any value to be returned before and after the STARTTIME and ENDTIME.
If I return a “zero” the visualization in the chart get messed up and it returns the wrong values for other parameters.
Maybe it’s not possible? What’s your thoughts?
Thanks Patrik
01/24/2023 at 11:49 AM #208083This always plots the same variable, but makes it invisible outside the selected time interval:
1234567t = 0x = closeIF (Time >= 100000) AND (Time <= 110000) THENt = 255ENDIFDrawText("#x#",BarIndex,high + average[20,0](range)) coloured("Green",t)RETURN01/24/2023 at 11:55 AM #20808501/24/2023 at 12:12 PM #208095What do you mean by “DYNAMIC” ?
01/24/2023 at 1:05 PM #208104…well, basically “t” will be the result of a changing parameter calculation/indicator in my code. In your example it’s set to t=255, but I guess that “t” can represent any given result/value from another calculation/indicator.
Right?
/Pat
01/24/2023 at 7:14 PM #208149t is just the Alpha, or Transparency, attribute to be used with colours to make them fully visible or not, it can range from 0 to 255, 255=fully visible and 0=invisible (an example about COLOURED at https://www.prorealcode.com/documentation/drawarrow/.
-
AuthorPosts
Find exclusive trading pro-tools on