Need a bit of help or at least someone put eyes on my code (shown below). Appreciate any suggestions. Embarrassed to admit have already spent over 30 hours on this. Thanks in advance!
Background: I'm well versed in TOS but recently started coding with thinkscript to check strategies.
Goal: With this strategy, I want to look at entering a long or short position when the price moves a predefined distance from its price at a certain time of day. Then once I enter a trade, execute an OCO bracket set at predefined limit/stop. Seems pretty straightforward, but am getting errors. I also want to evaluate this strat at the longest possible timeframe (at least a year) and make trade entry/exit decisions on the shortest possible timeframe (1 min or less).
Test environment: Using onDemand of course and set most of my variables to plot so I can debug.
Errors/Challenges:
1. It seems that if I use the 1 min timeframe for evaluating price to trigger the trade, I can't increase my chart timeframe to evaluate P&L on the strat. When I increase timeframe, the strat doesn't appear to run. I did read that TOS won't let you add data from smaller timeframes to larger timeframes on charts, but evaluating P&L's on larger timeframes must be do-able for strategies that depend on small timeframes to trigger actions.
Background: I'm well versed in TOS but recently started coding with thinkscript to check strategies.
Goal: With this strategy, I want to look at entering a long or short position when the price moves a predefined distance from its price at a certain time of day. Then once I enter a trade, execute an OCO bracket set at predefined limit/stop. Seems pretty straightforward, but am getting errors. I also want to evaluate this strat at the longest possible timeframe (at least a year) and make trade entry/exit decisions on the shortest possible timeframe (1 min or less).
Test environment: Using onDemand of course and set most of my variables to plot so I can debug.
Errors/Challenges:
1. It seems that if I use the 1 min timeframe for evaluating price to trigger the trade, I can't increase my chart timeframe to evaluate P&L on the strat. When I increase timeframe, the strat doesn't appear to run. I did read that TOS won't let you add data from smaller timeframes to larger timeframes on charts, but evaluating P&L's on larger timeframes must be do-able for strategies that depend on small timeframes to trigger actions.
Last edited: