Closing Price January Higher than December Close
Forums › ProRealTime English forum › ProOrder support › Closing Price January Higher than December Close
- This topic has 27 replies, 3 voices, and was last updated 4 days ago by
Lambo.
-
-
05/13/2024 at 2:50 PM #23260605/15/2024 at 4:05 PM #232686
Hello Roberto,
i Failed to change the code for another January Strategie. Perhaps you can help me:
If Close of January is higher than Open of January than it is allowed to buy
on First Trading day of February and on every 25 th of every month until the end of the year
Close trade is the same a new 200 Day High
and SL SMA200 *0,97
Thanks a lot
It is very difficult with the tally for me.
08/15/2024 at 4:48 PM #236419Thank you very much Roberto.
It Works.
Do you have an idea how i can integrate the Idea buy “day>24”, because with the code you buy this year on 30.1 , 29.2. and 28.3, right would be 25.1, 26.2 and 25.3.
Thanks a lot
Sorry for the Delay!
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051ONCE EntryDay = 24ONCE MonthDay1 = 5ONCE MonthDay2 = 10ONCE Tally = 0ONCE AboveFlag = 0// ate the beginning of each year save the closing price of the previous yearIF OpenYear <> OpenYear[1] THENYearClose = close[1]AboveFlag = 0ENDIF// at the beginning of each Month reset the tally of trading days to zeroIF (OpenMonth <> OpenMonth[1]) THENTally = 0ENDIF// each new day updates the tallyIF (OpenDay <> OpenDay[1]) THENTally = Tally + 1ENDIF// between day 5 and day 10 check if the price is above the previous Year's closing priceIF (Tally >= MonthDay1) AND (Tally <= MonthDay2) AND (OpenMonth = 1) THENAboveFlag = max(AboveFlag,close > YearClose)ENDIF// enter after trading day 24 if conditions are metIF (OpenDay >= EntryDay) AND AboveFlag AND Not OnMarket THENBUY 1 CONTRACT AT MARKETENDIF// TAKE PROFIT: exit when the price closes below DONCHIAN UPONCE p = 20Upper = HIGHEST[p](HIGH[1])TPflag = close > UpperIF LongOnMarket AND TPflag THENSELL AT MARKETENDIF// STOP LOSS: exit when the price closes below (Sma200 - 3%)Sma200 = average[200,0](close) * 0.97SLflag = close < Sma200IF LongOnMarket AND SLflag THENSELL AT MARKETENDIF// debugging section//graphonprice YearClose coloured("Blue")//graphonprice Sma200 coloured("Fuchsia")//graph Tally//graph AboveFlag08/15/2024 at 5:08 PM #236420Hello Roberto,
i Failed to change the code for another January Strategie. Perhaps you can help me:
If Close of January is higher than Open of January than it is allowed to buy
on First Trading day of February and on every 25 th of every month until the end of the year
Close trade is the same a new 200 Day High
and SL SMA200 *0,97
Thanks a lot
It is very difficult with the tally for me.
There you go:
1234567891011121314151617181920212223242526DEFPARAM CumulateOrders = true// check if JANUARY is a bullish monthTimeframe(Monthly)ONCE TradeOK = 0If OpenMonth = 1 THENTradeOK = 0IF close > open THENTradeOK = 1ENDIFENDIF//Timeframe(Daily,UpdateOnClose)//IF (OpenMonth > 1) AND TradeOK AND ((OpenMonth <> OpenMonth[1]) AND Not OnMarket) OR ((OpenMonth > 1) AND (OpenDay >= 25) AND (abs(CountOfPosition) < 2)) THENSL = average[200,0](close) * 0.97BUY 1 CONTRACT AT MARKETSET STOP LOSS SLENDIF//HH = highest[200](high[1])IF LongOnMarket AND (high >= HH) THENSELL AT MARKETENDIFgraphonprice HH AS "new 200-day High" coloured("Blue")graphonprice SL AS "Srop Loss" coloured("Red")graphonprice TradePrice04/17/2025 at 9:02 AM #245998Hello Roberto,
the code doesn’t work as estimated
TimeFrame(Yearly)
ClosePreviousYear = Close[1]with this parameter i get the information for the hole year.
How can I get a yes for a if /else when I prove the condition in january but I am actually in april?
// Prüfen, ob mindestens ein Schlusskurs zwischen dem 6. und 12. Januar höher ist als der Schlusskurs des Vorjahres
IF (Month = 1 AND (Day >= 6 AND Day <= 12) AND Close > ClosePreviousYear) THEN
Januarbarometer = 1 // Speichert die Bedingung für das ganze Jahrelse
Januarbarometer = 0
ENDIF// Kauforder am 25. jedes Monats, wenn Bedingung erfüllt ist
IF NOT LongOnMarket AND Day = 25 AND Januarbarometer = 1 THEN
BUY 1 CONTRACT AT MARKET
ENDIFI didn’t get it with this one
04/17/2025 at 9:04 AM #24600112345678910111213141516171819TimeFrame(Yearly)ClosePreviousYear = Close[1]// Zurück zur täglichen ZeitebeneTimeFrame(Daily)// Prüfen, ob mindestens ein Schlusskurs zwischen dem 6. und 12. Januar höher ist als der Schlusskurs des VorjahresIF (Month = 1 AND (Day >= 6 AND Day <= 12) AND Close > ClosePreviousYear) THENJanuarbarometer = 1 // Speichert die Bedingung für das ganze JahrELSEJanuarbarometer = 0ENDIF// Kauforder am 25. jedes Monats, wenn Bedingung erfüllt istIF NOT LongOnMarket AND Day = 25 AND Januarbarometer = 1 THENBUY 1 CONTRACT AT MARKETENDIF04/17/2025 at 9:12 AM #24600204/17/2025 at 9:19 AM #246004// Setze den TimeFrame auf jährlich, um den Schlusskurs des Vorjahres zu speichern
TimeFrame(Yearly)
ClosePreviousYear = Close[1]// Zurück zur täglichen Zeitebene
TimeFrame(Daily)ONCE EntryDay = 24
ONCE MonthDay1 = 9
ONCE MonthDay2 = 11
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 (OpenDay >= EntryDay) AND AboveFlag AND Not and day<28 and day>24 THEN
BUY 1 CONTRACT AT MARKET
ENDIFif longonmarket and day>4 then
sell at market
endif04/17/2025 at 9:22 AM #24600504/22/2025 at 3:35 PM #246235What use is NOT in this line:
1IF (OpenDay >= EntryDay) AND AboveFlag AND Not and day<28 and day>24 THEN?
04/23/2025 at 8:03 AM #24625504/23/2025 at 8:06 AM #2462561234567891011121314151617181920212223242526272829303132333435363738394041424344// Setze den TimeFrame auf jährlich, um den Schlusskurs des Vorjahres zu speichernTimeFrame(Yearly)ClosePreviousYear = Close[1]// Zurück zur täglichen ZeitebeneTimeFrame(Daily)ONCE EntryDay = 24ONCE MonthDay1 = 9ONCE MonthDay2 = 11ONCE Tally = 0ONCE AboveFlag = 0// ate the beginning of each year save the closing price of the previous yearIF OpenYear <> OpenYear[1] THENYearClose = close[1]AboveFlag = 0ENDIF// at the beginning of each Month reset the tally of trading days to zeroIF (OpenMonth <> OpenMonth[1]) THENTally = 0ENDIF// each new day updates the tallyIF (OpenDay <> OpenDay[1]) THENTally = Tally + 1ENDIF// between day 5 and day 10 check if the price is above the previous Year's closing price. If it is correct you are allowed to buy every month on 25. thIF (Tally >= MonthDay1) AND (Tally <= MonthDay2) AND (OpenMonth = 1) THENAboveFlag = max(AboveFlag,close > YearClose)ENDIF// enter after trading day 24 if conditions are met. but you only allowed to buy once in a month!!!IF day<28 and day>24 and (OpenDay >= EntryDay) AND AboveFlag AND not OnMarket THENBUY 1 CONTRACT AT MARKETENDIF//Exit after the month beginningif longonmarket and day>4 thensell at marketendif04/23/2025 at 8:07 AM #246257there was missing not on market… i put the code here.
1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on