Monthly pivot
Forums › ProRealTime English forum › ProScreener support › Monthly pivot
- This topic has 9 replies, 3 voices, and was last updated 6 years ago by robertogozzi.
-
-
05/29/2018 at 12:41 PM #71574
Hi everyone,
I looked for an answer before publishing my question, then sory if someone already replied for a similar question.
So, I try to have monthly pivot (code below), and to display via SCREENER.
it don’t work, and display 0 (zero), i don’t know why !
My questions are :
- do my monthly pivot calculation is right ?
- why it don’t detect anything, and display “0”?
123456789101112131415161718====CODE===ONCE LastMonthBarIndex = BarIndex// Monthly data settingONCE monthlyH = Highest[BarIndex - lastMonthBarIndex](High)[1]ONCE monthlyL = Lowest[BarIndex - lastMonthBarIndex](Low)[1]ONCE monthlyC = DClose(1)ONCE monthlyO = Open[BarIndex - lastMonthBarIndex]ONCE mPivot = (monthlyO + monthlyH + monthlyL + monthlyC) / 4If month <> Month[1] thenmonthlyH = Highest[BarIndex - lastMonthBarIndex](High)[1]monthlyL = Lowest[BarIndex - lastMonthBarIndex](Low)[1]monthlyC = DClose(1)monthlyO = Open[BarIndex - lastMonthBarIndex]mPivot = (monthlyO + monthlyH + monthlyL + monthlyC) / 4ENDIFc1 = mPivot > 1SCREENER[c1] (mPivot AS "% dPivot")//SCREENER[c3 AND c4] (mPivot < wPivot AS "% dPivot")Thanks, and many green pips / ticks for everybody.
Jean
05/29/2018 at 12:59 PM #7157705/29/2018 at 1:42 PM #71586Hi vonasi,
thanks a lot
05/29/2018 at 3:44 PM #71605Practicing with the search utility won me this link https://www.prorealcode.com/prorealtime-indicators/daily-weekly-monthly-pivot-points/.
You may win more!
05/29/2018 at 10:02 PM #71649Hi and thanks for the answer…
I forget to tell that it for a screener.
I tried the solution in the link above , the screener display “0” for all products selected !
I don’t really know what is wrong !
screener Monthly pivot1234567891011Once lastMonthBarIndex = 0Once monthlyH = undefinedOnce monthlyL = undefinedOnce mPivot = undefinedIf month <> Month[1] thenmonthlyH = Highest[BarIndex - lastMonthBarIndex](High)[1]monthlyL = Lowest[BarIndex - lastMonthBarIndex](Low)[1]LastMonthBarIndex = BarIndexmPivot = (Open + monthlyH + monthlyL + Close[1]) / 4ENDIFSCREENER[c1 AND c2 OR c3 AND c4] (mPivot AS "% dPivot")thans for everything
Jean
05/29/2018 at 11:58 PM #71659Screeners are not applicable to MONTHLY TF, Weekly is the highest one. But you can calculate monthly pivots and use them in a lower TF.
The screener is missing variable C1, C2, C3 and C4.
05/30/2018 at 11:19 AM #71684Hi RobertoGozzi, thanks for the answer,
effectively, I posted the old code, here is the new :
123456789101112Once lastMonthBarIndex = 0Once monthlyH = undefinedOnce monthlyL = undefinedOnce mPivot = undefinedIf month <> Month[1] thenmonthlyH = Highest[BarIndex - lastMonthBarIndex](High)[1]monthlyL = Lowest[BarIndex - lastMonthBarIndex](Low)[1]LastMonthBarIndex = BarIndexmPivot = (Open + monthlyH + monthlyL + Close[1]) / 4ENDIFc1 = mPivot < HighSCREENER[c1] (mPivot AS "% mPivot")Ok, there is no mean to have directly the monthly pivot, but the code above allow to calculate it (i’m not sure for the open price). once the monthly pivot calculated, i would like to display it with the last code line (SCREENER[c1] (mPivot As “% mPivot”).
But instead I only have “0” for all rows, how can i correct that ?
I hope I’m enough clear…
don’t hesitate if I can clerify more.
Thanks and cheers
Jean
05/30/2018 at 3:00 PM #71700I tried this code as an indicator and it works perfectly (see screenshot):
Monthly PIVOT indicator123456789If Month<>Month[1] thenmonthlyHigh = Highest[BarIndex - lastMonthBarIndex](High)[1]monthlyLow = Lowest[BarIndex - lastMonthBarIndex](Low)[1]lastMonthBarIndex = BarIndexmonthlyPivot = (Open + monthlyHigh + monthlyLow + Close[1]) / 4Endifx = high > monthlyPivoty = -(low < monthlyPivot)Return x OR y,0While the same code as a screener on a 4-hour TF does not return any valid scan for HIGH > monthlypivot or LOW < monthlypivot.
I guess it may be that ProScreener can only scan at most 255 bars (the current one + the previous 254), while highest and lowest use more!
05/30/2018 at 3:02 PM #71703The solution could be to use it as an indicator and then code a screener that reads the values returned by the indicator.
I’ll have a try.
05/30/2018 at 3:26 PM #71711It doesn’t work either.
-
AuthorPosts
Find exclusive trading pro-tools on