Forums › ProRealTime English forum › ProOrder support › Closing Price January Higher than December Close › Reply To: Closing Price January Higher than December Close
05/08/2024 at 5:18 PM
#232500
There you go:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
ONCE EntryDay = 18 ONCE MonthDay1 = 5 ONCE MonthDay2 = 10 ONCE Tally = 0 ONCE AboveFlag = 0 // ate the beginning of each year save the closing price of the previous year IF OpenYear <> OpenYear[1] THEN YearClose = close[1] AboveFlag = 0 ENDIF // at the beginning of each Month reset the tally of trading days to zero IF (OpenMonth <> OpenMonth[1]) THEN Tally = 0 ENDIF // each new day updates the tally IF (OpenDay <> OpenDay[1]) THEN Tally = Tally + 1 ENDIF // between day 5 and day 10 check if the price is above the previous Year's closing price IF (Tally >= MonthDay1) AND (Tally <= MonthDay2) AND (OpenMonth = 1) THEN AboveFlag = max(AboveFlag,close > YearClose) ENDIF // enter after trading day 24 if conditions are met IF (Tally > EntryDay) AND AboveFlag AND Not OnMarket THEN BUY 1 CONTRACT AT MARKET ENDIF // TAKE PROFIT: exit when the price closes below DONCHIAN UP ONCE p = 20 Upper = HIGHEST[p](HIGH[1]) TPflag = close > Upper IF LongOnMarket AND TPflag THEN SELL AT MARKET ENDIF // STOP LOSS: exit when the price closes below (Sma200 - 3%) Sma200 = average[200,0](close) * 0.97 SLflag = close < Sma200 IF LongOnMarket AND SLflag THEN SELL AT MARKET ENDIF // debugging section graphonprice YearClose coloured("Blue") graphonprice Sma200 coloured("Fuchsia") //graph Tally //graph AboveFlag |