Basic pivot point intraday trading strategy
Forums › ProRealTime English forum › ProOrder support › Basic pivot point intraday trading strategy
- This topic has 8 replies, 5 voices, and was last updated 7 years ago by Elsborgtrading.
Tagged: intraday, pivot points
-
-
05/04/2017 at 8:29 AM #34489
A very basic strat i have used manually but with more flexability. Would require
further back testing. Happy for your comments, very new to code so go easy on me!1234567891011121314151617181920212223// Definition of code parametersDEFPARAM CumulateOrders = False// Cumulating positions deactivated // The system will cancel all pending orders and close all positions at 0:00. No new ones will be allowed until after the "FLATBEFORE" time.DEFPARAM FLATBEFORE = 070000// Cancel all pending orders and close all positions at the "FLATAFTER" timeDEFPARAM FLATAFTER = 184500// Prevents the system from placing new orders on specified days of the weekdaysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0// Conditions to enter long positionsignored, ignored, ignored, ignored, ignored, ignored, indicator1 = CALL "Daily Pivots Points"c1 = (close CROSSES UNDER indicator1)IF c1 AND not daysForbiddenEntry THENBUY 1 PERPOINT AT MARKETENDIF// Conditions to enter short positionsignored, ignored, ignored, indicator2, ignored, ignored, ignored = CALL "Daily Pivots Points"c2 = (close CROSSES OVER indicator2)IF c2 AND not daysForbiddenEntry THENSELLSHORT 1 PERPOINT AT MARKETENDIF// Stops and targetsSET STOP pLOSS 10SET TARGET pPROFIT 202 users thanked author for this post.
05/04/2017 at 9:47 AM #3449505/04/2017 at 9:50 AM #34496Hiya, thanks for starting the topic. Would you care to explain a bit more around the premise – why it works, etc?
Apart from eurodollar M3 what other assets and resolutions have you tested this on?
Here is a template / boilerplate that will make it more portable and easier for the community to back test different instruments.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112// ====================================== \\// :: System Parameters --// -------------------------------------- //DEFPARAM cumulateOrders = falseDEFPARAM flatBefore = 070000DEFPARAM flatAfter = 184500// ====================================== \\// :: Globals --// -------------------------------------- //once positionSize = 1// ====================================== \\// :: Optimizations --// -------------------------------------- //once optimization = 1// -- Optimization selection setsif optimization = 1 then // EUR_USD M3dayStart = 230000 // for pivot pointstradingTime = not (openDayOfWeek = 6 OR openDayOfWeek = 0)pointTarget = 20pointRisk = 10elsif optimization = 2 then // ANOTHER MARKET//dayStart = 230000//tradingTime = not (openDayOfWeek = 6 OR openDayOfWeek = 0)//pointTarget = 20//pointRisk = 10endif// ====================================== \\// :: Indicator logic--// -------------------------------------- //// -- Pivot points ================= \\nd = dayStartif barindex = 0 theninit = 1lastClose = undefinedlastHigh = undefinedlastLow = undefinedPP = undefinedRes1 = undefinedRes2 = undefinedRes3 = undefinedSup1 = undefinedSup2 = undefinedSup3 = undefinedelsendA = ( time[2] < nd and time[1] >= nd AND dayofweek <> 0)ndB = ( time[2] < nd and time[1] >= nd and dayofweek[1] <> 0 and dayofweek[0] = 0)isNewDay = ndA or ndB // bit of speed optimziationif isNewDay thenif init = 1 thenlastHigh = HighlastLow = Lowinit = 2elsif init = 2 thenlastClose = Close[1]PP = (lastClose + lastHigh + lastLow) / 3hl = lastHigh - lastLowRes1 = 2 * PP - lastLowSup1 = 2 * PP - lastHighRes2 = PP + hlSup2 = PP - hlRes3 = Res1 + hlSup3 = Sup1 - hllastHigh = HighlastLow = Lowendifendifif init = 2 thenlastHigh = Max(lastHigh, High)lastLow = Min(lastLow, Low)endifendif// ----------------------------------- //// Ignored values to stop PRT kicking up a fussif Res2 or Sup2 thenendif// ====================================== \\// :: Conditional logic--// -------------------------------------- //closeAboveSup3 = (close CROSSES UNDER Sup3)closeBelowRes3 = (close CROSSES OVER Res3)bc1 = tradingTime and closeAboveSup3sc1 = tradingTime and closeBelowRes3// ====================================== \\// :: Execution Handlers --// -------------------------------------- //// -- Entry --if bc1 thenbuy positionSize perPoint at Marketendifif sc1 thensellShort positionSize perPoint at Marketendif// -- Exit --if onMarket thenSET STOP pLOSS pointRiskSET TARGET pPROFIT pointTargetendifHope that’s of use
Best,
M
4 users thanked author for this post.
05/04/2017 at 9:51 AM #34498Indicator is included in above template btw
1 user thanked author for this post.
05/04/2017 at 4:18 PM #34554HI Maz.
Its just a simple fade trading strat really. Wanted to put it out there for traders like yourself to maybe think of ways to add and improve it.
Tested on FSTE wasnt great, but was good on the AUD/USD. I tried 5m but wasnt as good.
Thanks for the code, much more like it!!
05/04/2017 at 9:58 PM #3457805/05/2017 at 10:22 AM #34611I used it on my spreadbet market IG. I included the spread size of 0.8 tick which is larger than the 0.6 i pay. I done this to allow for slippage.
05/05/2017 at 10:25 AM #34615It might be even more effective if combined with daily ATR.
05/05/2017 at 1:32 PM #34619@MAZ did you format this code with Notepad++ and copy pasted it? It seems like it’s keeping the formatting when I copy it into onenote- that is nice 🙂
Cheers Kasper
-
AuthorPosts
Find exclusive trading pro-tools on