IF IntradayBarIndex
Forums › ProRealTime English forum › ProBuilder support › IF IntradayBarIndex
- This topic has 3 replies, 3 voices, and was last updated 7 years ago by gabri.
-
-
07/11/2017 at 11:05 AM #40335
Maybe I have a problem understanding the IntradayBarIndex. This is what I don’t understand:
- I create a one-time ranger and all is perfect.
- I create a two-time ranger and IntradayBarIndex “does not obey”
In the picture you see
- (the boxes just mark the whole time range)
- the High lines of the Pre market (same time range in both versions).
- The one-time ranger in bold dashes which does start with the IntradayBarIndex value for highestPrice at zero
- the two-time ranger as smaller line which does not start with the IntradayBarIndex value zero.
I thought that setting the IntradayBarIndex once in the beginning would do the job for the whole indicator, means when the first time range (in this case 8:00-9:00) is activated by setting it TRUE we begin calculating with zero.
Am I making a thinking mistake here?
Thanks.
one-time ranger1234567891011IF IntradayBarIndex = 0 THENhighestPrice = 0lowestPrice = close * 100ENDIFTimeRange = ( Time > 080000 AND Time < 085959 )IF TimeRange THENhighestPrice = max(highestPrice,high)lowestPrice = min(lowestPrice,low)ENDIFRETURN highestPrice as "Buytrigger", lowestPrice as "Selltrigger"two-time ranger1234567891011121314151617181920212223242526IF IntradayBarIndex = 0 THENhighestPrice = 0lowestPrice = close * 100ENDIF// --- extern: PreMarket (bool), NormMaket (bool)PrTimeRange = ( time > 080000 AND time < 085959 )NoTimeRange = ( time > 090000 AND time < 095959 )// --- 1st rangerIF PreMarket THENIF PrTimeRange THENhighestPrice = max(highestPrice,high)lowestPrice = min(lowestPrice,low)PrHigh = highestPricePrLow = lowestPriceENDIFENDIF// --- 2nd rangerIF NormMarket THENIF NoTimeRange THENhighestPrice = max(highestPrice,high)lowestPrice = min(lowestPrice,low)NoHigh = highestPriceNoLow = lowestPriceENDIFENDIFRETURN PrHigh as "PreMarketRange High", PrLow as "PreMarketRange Low", NoHigh as "MarketRange High", NoLow as "MarketRange Low"07/13/2017 at 10:40 AM #4053407/13/2017 at 8:46 PM #40589Thanks Nicolas for the idea. But – there is always a but 🙁
I change the code to use two different starting limits and calculate with them. I just show the PreMarket=true in the picture because NormMarket does the same.
- thick blue line is High Line starting only at the beginning of the chart with zero
- dark blue dashes is the Low Line, also starting only at the beginning and not as it should at close*100
The orignal idea of having only one defintion of highest and lowest in the IntradayBarIndex was: as soon as one Ranger is started, it should look up the IntradayBarIndex values and then do its job. If now the second Ranger is started (this one would start later than the first one, so) there is actually no real need for the IntradayBarIndex values as we know already know highs and lows.
Here is the modified code that goes with the picture:
2-range marker 1.01123456789101112131415161718192021222324252627282930IF IntradayBarIndex = 0 THENPRhighestPrice = 0PRlowestPrice = close * 100NOhighestPrice = 0NOlowestPrice = close * 100ENDIF// --- extern: PreMarket (bool), NormMarket (bool)//PreMarket=1//NormMarket=0PrTimeRange = ( time > 080000 AND time < 085959 )NoTimeRange = ( time > 090000 AND time < 095959 )// --- 1st rangerIF PreMarket THENIF PrTimeRange THENPRhighestPrice = max(PRhighestPrice,high)PRlowestPrice = min(PRlowestPrice,low)PrHigh = PRhighestPricePrLow = PRlowestPriceENDIFENDIF// --- 2nd rangerIF NormMarket THENIF NoTimeRange THENNOhighestPrice = max(NOhighestPrice,high)NOlowestPrice = min(NOlowestPrice,low)NoHigh = NOhighestPriceNoLow = NOlowestPriceENDIFENDIFRETURN PrHigh as "PreMarketRange High", PrLow as "PreMarketRange Low", NoHigh as "MarketRange High", NoLow as "MarketRange Low"Thanks for your attention.
07/18/2017 at 12:17 PM #40952I am giving you my two cents on this. You are using a TF 30 mins. If Intradaybarindex=0 goes from 0800 till 0830, you will not have any data available for this intradyabarindex until 0830 (close time of the first intraday bar). This means that only after 0830 you will have a good computation of values. I cannot really see the scale on the bottom. If you want to troubleshoot the problem try to add the return line return intradaybarindex
-
AuthorPosts