AbzParticipant
Veteran
hello
is there a prameter for exit end of day without using time? when testing on daily chart i want the system to close the position at end of day.
Hi Abz, I think there will always be a definition on when is the end of the day- So you cannot ignore time. I mainly use two definition.
defparam flatbefore=080000//no positions open before
defparam flatafter=170000//all position will be closed after
or
//Trade hours- only opens positions during these hours.
IF (Time >= 08000 AND Time <= 113000) OR (Time >= 130000 AND Time <= 170000) THEN // no trading during lunch
Tradetime=1
else
Tradetime=0
endif
if <what ever condition> and tradetime then
etc.. etc...
StefParticipant
Average
PRT will always exit on the next bar open. There is no way to set it to exit on bar close.
Hi Stef. what is the difference? bar close= next bar open
StefParticipant
Average
No. Bar open is not necessarily previous bar’s close. Think of instruments for which there is a defined market open and close – more often than not, the price will open higher or lower than the previous market close. With auction markets, there is also an auction in the morning before the market opens or before it closes in the afternoon. After the pre-market or post-market auction, chances are that the next open will not equal the previous close. Another example would be for instruments where there is a lack of liquidity. Next bar can open anywhere, depending on where the next trade happens to take place.
I guess it depends on what you are trading and what timeframes. For some markets and instruments it is not necessarily an issue. But still, you cannot assume this to be the case.
PS: Some trading platforms allow you define backtests with ‘OPEN ON CURRENT BAR CLOSE’ vs ‘OPEN ON NEXT BAR OPEN’ – although automated trading systems have a hard time trading ‘ ON CURRENT BAR CLOSE.’
Stef