Hi,
I am looking for a solution that allows me to display entries on a daily basis at the open and exits at the close. The close should always take place on the last day of the month. If it does not work on a daily basis, I can also switch to a smaller time unit. Are there any solutions for this?
Thanks in advance
Greets Björn
This code will enter at the opening of each new day and will close at the end of the day.
If you want to close at a different time, just let me know.
It must be used on an intraday timeframe:
Timeframe(Daily,default)
IF abs(CountOfPosition) = 0 THEN
BUY 1 CONTRACT AT MARKET
ENDIF
//
Timeframe(default)
IF Day <> Day[1] THEN
SELL AT MARKET
ENDIF
Thanks for your reply Roberto!
If do it like that it doesn’t work:
Timeframe(Daily,default)
IF abs(CountOfPosition) = 0 and day >20 and day<26 THEN
BUY 1 CONTRACT AT MARKET
ENDIF
//
Timeframe(default)
IF Day <> Day[1] THEN
SELL AT MARKET
ENDIF
In the picture you can see that the exit is on 26. of January not at the end of mont per close.
Do you have an idea why?
Timeframe is 1H.
Thank you.
Timeframe(Daily,default)
IF abs(CountOfPosition) = 0 THEN
BUY 1 CONTRACT AT MARKET
ENDIF
//
Timeframe(default)
IF Day <> Day[1] THEN
SELL AT MARKET
ENDIF
Try this version:
Timeframe(Daily,default)
IF abs(CountOfPosition) = 0 and day >20 and day<26 THEN
BUY 1 CONTRACT AT MARKET
ENDIF
//
Timeframe(Monthly,default)
IF Month <> Month[1] THEN
SELL AT MARKET
ENDIF
hi Björn, can you define mathematically „end of the month“? so definition is valid 10 (or 1000) years into the past – and also into the future?