Coding for first pullback after price crossed MA50
Forums › ProRealTime English forum › ProOrder support › Coding for first pullback after price crossed MA50
- This topic has 19 replies, 5 voices, and was last updated 5 years ago by robertogozzi.
-
-
06/11/2019 at 4:50 PM #10044106/11/2019 at 6:47 PM #10045006/11/2019 at 10:30 PM #10046506/12/2019 at 12:12 PM #10048706/13/2019 at 9:24 AM #100524
Hello Grahal,
I would appreciated coding help for following criterias to be met.
- SMA50 upward sloping for the past 10 bars.
- SMA50 was downward sloping for at least 10 bars, 50 bars ago. (Range thus between [60] and [50].)
- Highest pivot low (swing low) for past 50 bars.
Thanks. Hope to hear from you soon.
06/13/2019 at 9:50 AM #100525I’ll leave the coding to @AlexF so much better than me! (I struggle with my own coding! 🙂 )
I was only getting you to specify when exactly the entry trigger should occur when I asked … < % closeness to MA50.
I doubt you would want a specific entry point, e.g. MA50 + 5 points or = MA50 as it might not get to that point and then turn around zoom upwards while waving goodbye to you waiting there to enter … just like you predicted but you didn’t pull the trigger soon enough!? 🙂
06/13/2019 at 12:58 PM #10054306/13/2019 at 1:07 PM #100544Yea thats the hard part of coding those types of systems. Price might cross over 50MA 3 candles ago and retrace, or 10 candles or 50 candles then retrace.
You need to define that price
- WAS under ma50
- WAS “high” above ma50
- is currently not very high above ma50/retracing back to ma50, without it crossing under it(?)
edit: just a thought: multiple MA’s?
06/13/2019 at 11:36 PM #100602This is very basic:
MA crossing after previous crossing & pullback1234567891011121314DEFPARAM CumulateOrders = falseMinLookBack = 2 //2 crossing must have occured at least these bars before PullBackMaxLookBack = 17 //17 crossing must have occured at most these bars before PullBackMA50 = average[50,1](close)//50,1x = close crosses over ma50IF x OR (close > MA50 AND low < MA50) THEN //when a pullback occurs...IF summation[MinLookBack](x[1]) = 0 THENIF summation[MaxLookBack](x[MinLookBack + 1]) AND Not OnMarket AND close > open THENBUY 1 CONTRACT AT MARKETSET STOP pLOSS 50 //50SET TARGET pPROFIT 300 //300ENDIFENDIFENDIFWhen it detects a crossover it is interpreted as a crossover due to pullback if there has been a previous crossover AT LEAST min candles before and AT MOST max candles before.
06/14/2019 at 3:32 PM #10067406/15/2019 at 11:18 AM #100718This is very basic:
Sheeesh!!!! 🙂 🙂
06/15/2019 at 11:26 AM #100719Pretty expressive GraHal!
06/15/2019 at 12:20 PM #100725@RobertoGozzi … You knew I was just making some humour for a Saturday morning, right??
Perhaps I should have added … You ain’t seen my basic! 🙂
06/15/2019 at 12:41 PM #100731I knew that, I was on the same line of humor.
I wrote BASIC because it lacks trailing stop/break even, money/position management and other amenities!
1 user thanked author for this post.
06/15/2019 at 12:49 PM #100732Good results on 10k bars on 1 min TF! Spread = 4
Optimise weekly and / or when Gain / Loss ratio drops much below 2.
The variable settings I chose are well down from the top Gain and are out of sight on attached. Variable name is Line No (or should be!?).
I’ll set it going on Demo Fwd Test on Monday.
Roberto any chance you could do the same on the Short side please pretty please? Then the whole code will be yours!
-
AuthorPosts
Find exclusive trading pro-tools on