Hi so I created indicator called NFPDay and I calculate in there the Friday’s of the month.
Then I call the NFPDAY and say if it is 1 Criteria is met. However it is not executing.
Here is the code for the indicator and the ProOrder system
//Name NFPDAY
//Count of Fridays in a month Indicator
If Dayofweek = 4 Then
NewFriday = 1
else
NewFriday =0
endif
If Month = Month[1] then
Friday=Friday+NewFriday
else
Friday = NewFriday
Endif
Return Friday
//Strategy Code
DEFPARAM Flatafter = 153000
Friday = Call "NFPDAY"
IF Friday = 1 Then
DayOK=1
Else
DayOk=0
endif
If Time = 093000 Then
Active =1
Else
Active=0
Endif
If Close > Open Then
Bull =1
BeAR=0
ELSe
BEAR=1
BULL=0
endif
// Conditions to enter long positions
IF NOT LongOnMarket AND dayok and Active and Bull THEN
BUY 1 CONTRACTS AT MARKET
ENDIF
// Conditions to enter short positions
IF NOT ShortOnMarket AND dayok and Active and Bear THEN
SELLSHORT 1 CONTRACTS AT MARKET
ENDIF
// Stops and targets : Enter your protection stops and profit targets here
I suggest that you use OpenMonth and OpenDayOfWeek (they return the value at the opening of a candle) instead of Month and DayOfWeek (which return the same value, but when a candle closes):
//Name NFPDAY
//Count of Fridays in a month Indicator
If OpenMonth <> OpenMonth[1] then
Friday = 0
endif
If (OpenDayofweek = 4) AND (OpenDayofweek <> OpenDayofweek[1]) Then
NewFriday = 1
If OpenMonth = OpenMonth[1] then
Friday=Friday+NewFriday
else
Friday = NewFriday
endif
else
NewFriday =0
endif
Return Friday