In the ToS Charts page, I have this code in Strategies for selling one vertical put spread:
The code works and 1 options contract is sold (there is an arrow with the tekst -100 and the FloatingPL shows the correct P&L bars). But to me, it looks like the moment of selling the option contract is at a random day and time.
How can I add a specific date and time for selling the vertical put spread to this code? For example sell on date 5/7/21, time 9.03pm?
I will use this very simple strategy to start understanding backtest trading bull put spreads. I will add a trailing profit/loss to my strategy later.
Code:
def sell=if close()<open and close[1] then 1 else 0;
AddOrder(type = OrderType.SELL_AUTO, condition = sell, price = close, tradeSize = 100);
The code works and 1 options contract is sold (there is an arrow with the tekst -100 and the FloatingPL shows the correct P&L bars). But to me, it looks like the moment of selling the option contract is at a random day and time.
How can I add a specific date and time for selling the vertical put spread to this code? For example sell on date 5/7/21, time 9.03pm?
I will use this very simple strategy to start understanding backtest trading bull put spreads. I will add a trailing profit/loss to my strategy later.
Last edited: