Forums › ProRealTime English forum › ProOrder support › Coding for first pullback after price crossed MA50 › Reply To: Coding for first pullback after price crossed MA50
06/13/2019 at 11:36 PM
#100602
This is very basic:
MA crossing after previous crossing & pullback
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
DEFPARAM CumulateOrders = false MinLookBack = 2 //2 crossing must have occured at least these bars before PullBack MaxLookBack = 17 //17 crossing must have occured at most these bars before PullBack MA50 = average[50,1](close)//50,1 x = close crosses over ma50 IF x OR (close > MA50 AND low < MA50) THEN //when a pullback occurs... IF summation[MinLookBack](x[1]) = 0 THEN IF summation[MaxLookBack](x[MinLookBack + 1]) AND Not OnMarket AND close > open THEN BUY 1 CONTRACT AT MARKET SET STOP pLOSS 50 //50 SET TARGET pPROFIT 300 //300 ENDIF ENDIF ENDIF |
When 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.