Pivot monthly strategi
Forums › ProRealTime English forum › ProOrder support › Pivot monthly strategi
- This topic has 9 replies, 3 voices, and was last updated 8 years ago by Nicolas.
-
-
07/11/2016 at 10:51 AM #10394
Hello,
I’m currently building a strategy based on different kind of pivot points. In my testing I’m using a modified version of this indicator; http://www.prorealcode.com/prorealtime-indicators/daily-weekly-monthly-pivot-points/#comment-1059 . I though run into problems using the monthly pivot points in different ways. I’ll give you an example bellow;
123456789101112131415161718192021222324252627282930DEFPARAM CUMULATEORDERS = FALSE//Once lastMonthBarIndex = 0Once monthlyHigh = undefinedOnce monthlyLow = undefinedOnce monthlyPivot = undefinedIf Month<>Month[1] thenmonthlyHigh = Highest[BarIndex - lastMonthBarIndex](High)[1]monthlyLow = Lowest[BarIndex - lastMonthBarIndex](Low)[1]lastMonthBarIndex = BarIndexmonthlyPivot = (close[1] + monthlyHigh + monthlyLow) / 3EndifMM1 = AVERAGE[7](CLOSE)//C1 = MM1 CROSSES OVER MONTHLYPIVOTIF NOT LONGONMARKET AND C1 THENBUY 1 CONTRACTS AT MARKETSET STOP %LOSS 2SET TARGET %PROFIT 5ENDIFThis is just an example of what kind of strategy I’m trying to achieve. I can’t though see what I’m doing wrong here?
Help much appreciated!07/11/2016 at 4:12 PM #1039907/11/2016 at 6:38 PM #1040207/12/2016 at 7:49 AM #1040807/12/2016 at 8:31 AM #1041607/12/2016 at 9:02 AM #1041807/12/2016 at 4:22 PM #10432This is the fixed code:
1234567891011121314151617181920212223242526DEFPARAM CUMULATEORDERS = FALSEdefparam preloadbars = 20000Once lastMonthBarIndex = 0If Month <> Month[1] thenmonthlyHigh = Highest[BarIndex - lastMonthBarIndex](DHigh(1))monthlyLow = Lowest[BarIndex - lastMonthBarIndex](DLow(1))lastMonthBarIndex = BarIndexmonthlyPivot = (Dclose(1) + monthlyHigh + monthlyLow) / 3ENDIFMM1 = AVERAGE[7](CLOSE)GRAPH monthlypivotGRAPH lastmonthBarIndexC1 = MM1 CROSSES OVER MONTHLYPIVOTIF NOT LONGONMARKET AND C1 THENBUY 1 CONTRACTS AT MARKETSET STOP %LOSS 2SET TARGET %PROFIT 5ENDIFYour calculation of the monthly pivot were not good because you took the actual timeframe OHLC, which should be the Daily one that you can retrieve with DOPEN/DHIGH/DLOW/DCLOSE. I also add some bars to be preloaded in case it is needed.
07/13/2016 at 10:17 AM #1044409/18/2016 at 5:46 PM #13239Hi Guys
I’m struggling with my monthly and weekly pivots. This is my code (PS – I’m not really following the logic. Just copying and trying to adjust here and there):
12345678910Once lastMonthBarIndex = 0If Month <> Month[1] thenmonthlyHigh = Highest[BarIndex - lastMonthBarIndex](DHigh(1))monthlyLow = Lowest[BarIndex - lastMonthBarIndex](DLow(1))lastMonthBarIndex = BarIndexmonthlyPivot = (Dclose(1) + monthlyHigh + monthlyLow) / 3ENDIFreturn monthlyPivot as "MPivot"However, my last month data is as follows:
MHigh = 47144
MLow = 44802
MClose = 46201
MOpen = 46201
If I use the classic pivot calculation of (last month high + last month low + last month close) / 3 I get 46049. However the system shows a pivot of 46253? Why would it differ? How can I fix it please?
Thanks and regards
09/18/2016 at 7:00 PM #13242Maybe you can try first to see what values are returned by the calculation of the code and find how and why they are the ones actually calculated by it.
1return monthlyPivot as "MPivot", monthlyHigh as "high", monthlylow as "low", Dclose(1) as "monthly close" -
AuthorPosts
Find exclusive trading pro-tools on