Hallo everyone, I’m new to this program and I didin’t find the button to search into the forum.
As the title I would like to buy on the 27 of every month at the opening and sell after 2 days at the end of the day.
The other days I’ll go to fish 🙂
thanks in advance
The attached screenshot showswhere the search box is (it opens whenever you hover your pic).
What shall it do when the 27th is on a holiday?
And what if the next two days is past the end of the month?
Moreover, ProOrder is the support forum for strategy, as from the basic rules highlighted in yellow below.
I moved it from ProBuilder.
Thank you 🙂
Thanks Roberto, the problem about the holiday, If so I don’t buy. If after 2 days ther is holiday or there is another month, I’ll prefer to skip this buy.
There you go (I tested it on DAX, Daily TF):
TimeFrame(Daily,UpdateOnClose)
If OpenMonth <> OpenMonth[1] Then
OM = OpenMonth
OD = OpenDay
ODW = OpenDayOfWeek
OY = OpenYear
LastDay = 31
If OM = 4 or OM = 6 or OM = 9 or OM = 11 Then
LastDay = 30
Endif
If OM = 2 Then
LastDay = 28
If OY mod 4 = 0 Then
If OY mod 100 = 0 Then
If OY mod 400 = 0 Then
LastDay = 29
Endif
Else
LastDay = 29
Endif
Endif
Endif
EOM = OD //EOM=End Of Month
EntryDay = 0 //Day to enter a trade
ExitDay = 0 //Day to exit the trade opened on EntryDay
FOR i = OD + 1 To LastDay
ODW = ODW + 1
IF ODW = 7 THEN
ODW = 0
ENDIF
IF ODW <= 5 THEN
IF (i = 27) AND (i + 2) <= LastDay THEN
EntryDay = i
ELSIF (i >= (EntryDay + 2)) AND (ExitDay = 0) AND (EntryDay <> 0) THEN
ExitDay = i
ENDIF
ENDIF
NEXT
ENDIF
//
Timeframe(default)
IF ((OpenDay >= ExitDay) OR (OpenMonth <> OpenMonth[1])) AND LongOnMarket Then
SELL AT Market
Endif
//
If (OpenDay = EntryDay) AND (ExitDay > 0) AND Not OnMarket Then
BUY 1 contract at Market
Endif
//graph OpenMonth
//graph ExitDay
//graph EntryDay
//graph LastDay