I have a strategy backtester I am using, The strategy I am using is for credit spreads. I am wondering is there a way to setup a buy to close or sell to close code that will close out the trade at the closing price on Friday? The friday closing price immediately after trade entry? Would be amazing help! I have the whole rest of the code just need to close out the trades at the closing price on the closest Friday to trade entry, even if its just a 1 day trade. and the strategy backtester should calculate my PL based on if I bought shares when I have the signal to buy shares and then I will sell them at the closing price on the immediate Friday closing price after trade entry.
AddOrder(SELL_TO_CLOSE, "close out the shares purchased immediately at the next Friday closing price"
what is in quotes is what i am not sure how to code, hopefully this is a quick fix, thanks for any help!
AddOrder(SELL_TO_CLOSE, "close out the shares purchased immediately at the next Friday closing price"
what is in quotes is what i am not sure how to code, hopefully this is a quick fix, thanks for any help!