array variables availability in ProRealTime – examples and discussions
Forums › ProRealTime English forum › ProBuilder support › array variables availability in ProRealTime – examples and discussions
- This topic has 254 replies, 50 voices, and was last updated 2 months ago by robertogozzi.
-
-
03/28/2021 at 12:14 AM #165521
Hi @Robertogozzi, thanks for taking a look at this. I had an elaborate detailed question about some date issues with Market Watch and IG Index typed out here but (fortunately for you!) lost it somehow scrolling between Macbook desktops.
Basically, in short: Is there any reason why Saturday 20200321 doesn’t plot yet for every other Saturday and month does (except Jan 2021)?
Why are 20210116 and 20210117 missing?
Also I launched the PRT option dates indicator to check something and realised that every green line is plotted on the day before every single date in my indicator. How come?
Note: The official option expiry is technically on the third Saturday of each month, with trading stopping the day before (See Market Watch calendar linked in previous post). IG have the last option dealing a day earlier on the Thursday and expiry on Fridays. PRT has taken the Friday / Saturday Market Watch indicator dates and plotted them on the day before, i.e. Thursdays and Fridays?
Is is possible to forward project and plot dates for April, May, June etc 2021?
Cheers!
03/28/2021 at 1:25 AM #165528As I said DATE is the date when a bar closes, so it can only be plotted just mircosecoinds before the next bar opens (if it opens, though!). As the market shuts down on Friday 20200320, no line can be plotted when the market is closed.
The same is for the other two days.
Tha latter one is a SUNDAY date (which exists), but, being the date when the prior candle is closed, there is NO saturday candle at the close of which a line can be plotted. If, in this case, you use OPENDATE a line will be plotted.
03/28/2021 at 5:25 PM #165558Cheers @Robertogozzi, I wish had I had a copy of my lost long answer to explain better what I meant above in my “short” reply! I don’t understand the interdependency of the two dates in each month in terms of how PRT deals with them. Isn’t each date and it’s reciprocal green line an independent “Or” event?
For example, Re: Two missing green lines during March 2020.
The first line (a Friday) was a “fat thumb error” — 202003120 coded instead of 20200320. That line now appears when the “1” error is corrected. But not only does that Friday line appear but a line for Saturday too? If I remove just the date, Saturday 20200321, both lines still appear?
I wrote:
Also I launched the PRT option dates indicator to check something and realised that every green line is plotted on the day before every single date in my indicator. How come?PRT brings forward every single coded Friday and Saturday date I have like: “OR date = 20200320 OR date = 20200321” by one day? It’s plotting them on “DATE” 20200319 OR date = 20200320? Pls see images “19 mch 2020” and “20 mch 2020. The green lines are not plotted on the days coded — namely, Fridays and Saturdays — but on one day before, Thursdays and Fridays?
So I decided to simplify and removed all the Saturday Option Expiry dates and left just Friday “Stop Trading” (which is after all the most important warning) and re-launched and I still get two green lines on two different consecutive days, Thursdays and Fridays? What am I missing here?
(Your first reply written 27th Mch 2021)
Date (Saturday) 20200321 cannot be plotted because DATE is the date when a candle closes and it should have been plotted at the closure of Friday, March 20th, but it can’t be plotted because the systems stops due to the end of the week.(Your second reply 28th Mch 2021)
As I said DATE is the date when a bar closes, so it can only be plotted just mircoseconds before the next bar opens (if it opens, though!). As the market shuts down on Friday 20200320, no line can be plotted when the market is closed.As mentioned, it makes no difference if Saturday 20200321 is included in the code or not. Two lines are both plotted at the same time only when 202003120 is corrected to 20200320 and even if 20200321 (or any other second date of the month) is deleted from the code. All other Friday and Saturdays for 2020/2021 (bar jan 2021) plot okay despite being on a Friday and on the end of a week?
Missing Jan 2021 lines:
I tried OPENDATE for Jan 2021 but it wouldn’t plot. The Options Council actually states Jan 2021 Option Expiry was Friday 15th Jan 2021 so I amended the January dates to 20210115 and 20210116 and now every month plots expirations.Lastly, why can’t PRT project forward and plot dates for April, May, June etc 2021 like other options software? Not a criticism, just wondered if there was a way round this?
I hope that makes more sense.
Thanks very much,
Best Bard.03/28/2021 at 5:55 PM #165561You can plot in the future:
12345// plot N bars in the futureDrawSegment(BarIndex[20],close, BarIndex+10,close)//// plot up to a date in the futureDrawSegment(BarIndex[20],close, DateToBarIndex(20210402),close)1 user thanked author for this post.
03/28/2021 at 6:47 PM #165562But I am not aware of limits to how many bars or dates in the future are allowed.
1 user thanked author for this post.
03/31/2021 at 11:53 PM #165901Thanks a lot for the code, I’ll try it out at the weekend @Robertogozzi.
I’m still not sure why PRT is treating theses two option dates each month as interdependent instead of independent (interdependent because if I remove one date both green lines disappear?) or why it plots the date a day before the actual coded close date?
04/04/2021 at 12:22 PM #166156Thanks very much for your help Roberto.
This is the completed Indicator and I’ve added the Probability Cone Indicator code too in the hope that perhaps we could add/code them together in one indicator and then add this to the library @Robertogozzi, @Nicolas?
Option Expiry Dates123456789101112131415161718192021222324252627282930313233343536//Option Stop Trading Dates and Expiry Dates 2020/2021//https://www.marketwatch.com/optionscenter/calendar//https://www.optionseducation.Org/referencelibrary/expiration-calendarIf Date = 20200117 Or Date = 20200221 Or Date = 20200320 Or Date = 20200417 Or Date = 20200515 Or Date = 20200619 Or Date = 20200717 Or Date = 20200821 Or Date = 20200918 Or Date = 20201016 Or Date = 20201120 Or Date = 20201218 Or Date = 20210115 Or Date = 20210219 Or Date = 20210319 Or Date = 20210416 Or Date = 20210521 Or Date = 20210618 Or Date = 20210716 Or Date = 20210820 Or Date = 20210917 Or Date = 20211015 Or Date = 20211119 Or Date = 20211217 ThenDrawvLine(BarIndex[+0])Coloured (0,200,0)style (DottedLine)EndIf// Plot up to a Date in the Future (1 Year)DrawvLine(DateToBarIndex(20210416))Coloured (0,200,0)style (DottedLine)DrawvLine(DateToBarIndex(20210417))Coloured (0,200,0)style (DottedLine)DrawvLine(DateToBarIndex(20210521))Coloured (0,200,0)style (DottedLine)DrawvLine(DateToBarIndex(20210522))Coloured (0,200,0)style (DottedLine)DrawvLine(DateToBarIndex(20210618))Coloured (0,200,0)style (DottedLine)DrawvLine(DateToBarIndex(20210619))Coloured (0,200,0)style (DottedLine)DrawvLine(DateToBarIndex(20210716))Coloured (0,200,0)style (DottedLine)DrawvLine(DateToBarIndex(20210717))Coloured (0,200,0)style (DottedLine)DrawvLine(DateToBarIndex(20210820))Coloured (0,200,0)style (DottedLine)DrawvLine(DateToBarIndex(20210821))Coloured (0,200,0)style (DottedLine)DrawvLine(DateToBarIndex(20210917))Coloured (0,200,0)style (DottedLine)DrawvLine(DateToBarIndex(20210918))Coloured (0,200,0)style (DottedLine)DrawvLine(DateToBarIndex(20211015))Coloured (0,200,0)style (DottedLine)DrawvLine(DateToBarIndex(20211016))Coloured (0,200,0)style (DottedLine)DrawvLine(DateToBarIndex(20211119))Coloured (0,200,0)style (DottedLine)DrawvLine(DateToBarIndex(20211120))Coloured (0,200,0)style (DottedLine)DrawvLine(DateToBarIndex(20211217))Coloured (0,200,0)style (DottedLine)DrawvLine(DateToBarIndex(20211218))Coloured (0,200,0)style (DottedLine)DrawvLine(DateToBarIndex(20220121))Coloured (0,200,0)style (DottedLine)DrawvLine(DateToBarIndex(20220122))Coloured (0,200,0)style (DottedLine)DrawvLine(DateToBarIndex(20220218))Coloured (0,200,0)style (DottedLine)DrawvLine(DateToBarIndex(20220219))Coloured (0,200,0)style (DottedLine)DrawvLine(DateToBarIndex(20220318))Coloured (0,200,0)style (DottedLine)DrawvLine(DateToBarIndex(20220319))Coloured (0,200,0)style (DottedLine)//ReturnProbability Cone12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152// https://www.prorealcode.com/topic/array-variables-availability-in-prorealtime/// (please do not remove the link above for future reference)// Example #2: probability conedefparam drawonlastbaronly=true// --- settings//PriceField = 1 //1=customclose ; 0=high/low//vol = 0.025 //Assumed Volatility (ideally based on volTyp)//BarsFuture = 20 //No. of days ahead//stdPer = 2 //Std. Dev. quantity//decay = 12 //decay the cone at the previous X bar// --- end of settingsPrice = customclosehh=undefinedll=undefinedif(islastbarupdate) thenfor i = 0 to BarsFuture do//cone calculationStdDev = StdPer * Price * Vol * sqrt( i / 365 ) //3.6*if( PriceField ) then$u[i] = high[decay] + stdDev$d[i] = low[decay] - stdDevelse$u[i] = Price[decay] + stdDev$d[i] = Price[decay] - stdDevendifif i>0 then//upper conedrawsegment(barindex[decay]+i,$u[i],barindex[decay]+i-1,$u[i-1]) coloured(0,255,0)drawpoint(barindex[decay]+i,$u[i],1) coloured(0,255,0)//lower conedrawsegment(barindex[decay]+i,$d[i],barindex[decay]+i-1,$d[i-1]) coloured(255,0,0)drawpoint(barindex[decay]+i,$d[i],1) coloured(255,0,0)//filling the zonedrawtriangle(barindex[decay]+i,$u[i],barindex[decay]+i-1,$u[i-1],barindex[decay]+i,$d[i]) coloured(150,150,150,50) bordercolor(150,150,150,0)drawtriangle(barindex[decay]+i-1,$d[i-1],barindex[decay]+i,$d[i],barindex[decay]+i-1,$u[i-1]) coloured(150,150,150,50) bordercolor(150,150,150,0)endifnext//plot the middle linedrawsegment(barindex[decay],($u[0]+$d[0])/2,barindex[decay]+BarsFuture,($u[0]+$d[0])/2) style(dottedline)//plot the highest and lowest boundaries of the conehh=(arraymax($u)+arraymin($u))/2ll=(arraymax($d)+arraymin($d))/2endifreturn hh as "Short Call", ll as "Short Put"Volatility % Setting for the Probability Cone:
For the Probability Cone indicator’s standard deviation volatility setting bear in mind that although the 1985-2020 annualised standard deviation (SD) for the Dow Jones was 17.61%, the DIJA VIX high / low SD for the last 12 months ranged between approximately 17% and 56%:
https://fred.stlouisfed.org/series/VXDCLSS&P VIX Explained:
https://www.spindices.com/vix-intro/Note: Having a wide SD and low Volatility % setting (or visa versa), but choosing a decay date of a mini market fall out doesn’t mitigate you from forecasting Probability Cone errors! (Pls see images).
Cheers,
Bard04/04/2021 at 12:29 PM #16615904/04/2021 at 10:23 PM #166180Knowing how price has deviated in the past is interesting but knowing how it has deviated after an event compared to a datum is even more interesting:
https://www.prorealcode.com/prorealtime-indicators/edge-finder-and-condition-tester/
04/04/2021 at 11:02 PM #166183Interesting stuff! I’ll take a look this week.
I’ll be using the probability cone indicator (which is standard kit for high end options trading platforms) to help me make option strike price decisions in relation to volatility projections and option expiries. Great for Strangles and Spreads.1 user thanked author for this post.
04/10/2021 at 6:55 PM #166732I have searched the forum and topic to find how to return the index number of arraymax but not discovered it. Can someone tell me the way to do this please.
04/11/2021 at 8:30 AM #166755There is no instruction to get the array max index automatically, loop through the array to find what column of the array contain the value of arraymax.
1 user thanked author for this post.
04/11/2021 at 9:14 AM #166757Store the barindex value in a second array at the same location every time you store a value in your first array. Then loop through to find the location of ARRAYMAX and the barindex number will be at the same location in the second array.
1 user thanked author for this post.
04/20/2021 at 8:23 AM #167567I’m really grateful for this new Probability Cone indicator @Nicolas, it’s something that only high end Options Trading platforms provide.
I’ve added green dotted date lines for FOMC meetings to it for my Daily Dow and it’s been working fine until this morning. The cone seems to be disappearing and then reappearing?
I was using a 252 day Bars Future setting without any issue a fortnight ago, now it only seems stable if I use a setting below 90. Increase it to 100 days in the future and the cone starts disappearing again. It doesn’t seem to be effected by altering the Decay and Std Dev settings, the latter of which I’ve replicated the disappearing cone at 20 std devs down to 2 std devs).
Could it be my internet connection or its taking more time to calculate or calculating more often? Cheers.
04/20/2021 at 9:29 AM #167579Ps//
Is there a way to make the crosshairs return that actual Dow values as you move the crosshair forward into the future?
HH and LL values are static regardless of how far you move the crosshairs forward. Pls see 3 x red markup lines on each of the two chart screens. Thanks.Here’s the code, just in case:
Probability Cone1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768// https://www.prorealcode.com/topic/array-variables-availability-in-prorealtime/// (please do not remove the link above for future reference)// Example #2: probability cone//Volatility: These Dow and VIX readings at web addresses below are yearly. If Volatility = 17%, that's annual and ready for input in this cone indicator.//For 30 day volatility divide volatility index number by the sq root of 12://Eg, 20 / 3.46 = 5.78%//Dow//https://fred.stlouisfed.org/series/VXDCLS//https://markets.businessinsider.com/index/dow-jones-djia-vix//VIX//https://fred.stlouisfed.org/series/VIXCLS//https://markets.businessinsider.com/index/vix//Best VIX Explanation://https://www.spindices.com/vix-intro/defparam drawonlastbaronly=true// --- settings//PriceField = 1 //1=customclose ; 0=high/low//vol = 0.025 //Assumed Volatility (ideally based on volTyp)//BarsFuture = 20 //No. of days ahead//stdPer = 2 //Std. Dev. quantity//decay = 12 //decay the cone at the previous X bar// --- end of settingsPrice = customclosehh=undefinedll=undefinedif(islastbarupdate) thenfor i = 0 to BarsFuture do//cone calculationStdDev = StdPer * Price * Vol * sqrt( i / 365 ) //3.6*if( PriceField ) then$u[i] = high[decay] + stdDev$d[i] = low[decay] - stdDevelse$u[i] = Price[decay] + stdDev$d[i] = Price[decay] - stdDevendifif i>0 then//upper conedrawsegment(barindex[decay]+i,$u[i],barindex[decay]+i-1,$u[i-1]) coloured(0,255,0)drawpoint(barindex[decay]+i,$u[i],1) coloured(0,255,0)//lower conedrawsegment(barindex[decay]+i,$d[i],barindex[decay]+i-1,$d[i-1]) coloured(255,0,0)drawpoint(barindex[decay]+i,$d[i],1) coloured(255,0,0)//filling the zonedrawtriangle(barindex[decay]+i,$u[i],barindex[decay]+i-1,$u[i-1],barindex[decay]+i,$d[i]) coloured(150,150,150,50) bordercolor(150,150,150,0)drawtriangle(barindex[decay]+i-1,$d[i-1],barindex[decay]+i,$d[i],barindex[decay]+i-1,$u[i-1]) coloured(150,150,150,50) bordercolor(150,150,150,0)endifnext//plot the middle linedrawsegment(barindex[decay],($u[0]+$d[0])/2,barindex[decay]+BarsFuture,($u[0]+$d[0])/2) style(dottedline)//plot the highest and lowest boundaries of the conehh=(arraymax($u)+arraymin($u))/2ll=(arraymax($d)+arraymin($d))/2endifreturn hh as "Short Call", ll as "Short Put" -
AuthorPosts
Find exclusive trading pro-tools on