Strategy Backtester

J

john3

Member
VIP
Warehouse
Hello Everyone ,

You can request a backtest for your current strategies here.

Thanks
Hello sylar2017,

Regardless of a strategy, how would I limit the backtest only to the regular trading hours (RTH)? I trade futures and always have an overnight session displayed, but for a backtest I only would like to test the RTH.

In addition, also regardless of a strategy, but let's say it is a simple MAs cross, I would like to know an average price move after a signal has been triggered. For example, 10 SMA crossing 20 SMA both ways (up/down), the strategy enters on the next bar open after the cross, what is an average price move after the cross? It would be great if after the cross it would automatically plot a line with a user-selectable target. For example, after the cross, plot a line 2 point away from the cross.

Appreciate your help!
 
BenTen

BenTen

Administrative
Staff
VIP
Warehouse
@john3 You can try to apply the same method @WalkingBallista did in his code here.

Code:
def MarketOpenTime = 0930;
input TimeToStopSignal = 1525;
def TradeTimeFilter = SecondsFromTime(TimeToStopSignal);
Use that condition to only allow signals between market open and 1525 (which is 3:25 EST). Take a look at the full code in the post I linked. It should help.
 
S

Sree

New member
Hello Everyone ,

You can request a backtest for your current strategies here.

Thanks
Hi, is there a primer or notes on how to setup a strategy backtest and show P/L report in TOS?

Thanks!
 
T

tabs999

New member
hi i have a custom script that already plots arrows aka ( trade signals ) how do i set a target and stop for these signals and back test the results?
 
BenTen

BenTen

Administrative
Staff
VIP
Warehouse
@tabs999 We can’t help if you do not post your code.
 
Y

YungTraderFromMontana

Member
Has anyone made code to backtest the Supertrend strategy?
 
BenTen

BenTen

Administrative
Staff
VIP
Warehouse
@YungTraderFromMontana You can get a P/L report in excel and html format. You can use that to create your own graph.
 
Y

YungTraderFromMontana

Member
@YungTraderFromMontana You can get a P/L report in excel and html format. You can use that to create your own graph.
With free commisions now I may just try to get this strategy rolling on like 50 of the best suited stocks. The profits are crazy like 1000 a month on amd taken short and long. Get it going on on multiple stocks and I could be getting the most wicked stream of passive income. Are their any flaws in this plan? Does TD allow 1000's of daily orders and will the strategy have trouble performing in real time? Have you tried this?

Edit: for example look at the Profit on 1m for Roku today, 1,600 in 2 days. 5,000 in a week. Commisions would have gobbled gains on most stocks before but now if it executes like it says it does it becomes virtually riskless compared to holding shares.
 
Last edited:
S

Superfast

New member
Marketplace
I did the Supertrend Strat Results backtest on a 5 day 15 min chart from TOS, and it looked profitable - However, when you are actually trading, you don't get the same fills when the trigger paints (buy or sell). You will be off by a some amounts. I am now looking at how much you're off by. Or one can wait until it pulls back as close to as the original trigger price. If you create an alert, and that alert goes off which you could use as your trigger (before the buy signal is painted), I am not sure how much it may assist you in getting as close to a fill as what's on the strategy test results. I have an image of the results on my desktop but can't seem to include it here for some reason.
 
MBF

MBF

Active member
VIP
Warehouse
I did the Supertrend Strat Results backtest on a 5 day 15 min chart from TOS, and it looked profitable - However, when you are actually trading, you don't get the same fills when the trigger paints (buy or sell). You will be off by a some amounts. I am now looking at how much you're off by. Or one can wait until it pulls back as close to as the original trigger price. If you create an alert, and that alert goes off which you could use as your trigger (before the buy signal is painted), I am not sure how much it may assist you in getting as close to a fill as what's on the strategy test results. I have an image of the results on my desktop but can't seem to include it here for some reason.
SuperTrend or trend reversal?
You can upload the photo through Imgur.com, no need to sign up. Just load it in, copy the link they provide for your photo and paste it in the link tab (looks like a chain) above.
Have you tried the three minute and 15 with this? If Trend Reversal Strat, the 3 minute is about when you should get in for the five minute, all else lines up too.
 
S

Superfast

New member
Marketplace
If there is anyone who can get the trigger to paint as soon as one needs to buy or sell, this will be good. I'm not sure if it's offsets or how it is to be coded, but certainly may be worthwhile looking at.
 
MBF

MBF

Active member
VIP
Warehouse
If there is anyone who can get the trigger to paint as soon as one needs to buy or sell, this will be good. I'm not sure if it's offsets or how it is to be coded, but certainly may be worthwhile looking at.
Are you talking about the Trend Reversal indicator? In my box the SuperTrend is a different indi. Trend Reversal has the reversal bubbles. I’m stuck on my phone so not a lot of room to decipher.
i think you’re speaking of the Trend Reversal, if so, we all want that thing to paint right away but that’s the glory isn’t it? If it did that we’d all be raking it in! I wish! If you work with it you can get to know it and it works pretty nicely but it takes a lot of paper trading to get the groove. Its moody.
 
S

Superfast

New member
Marketplace
Thank you for the advice. I've traded with the Trend Reversal and it repaints, it's not bad but you do get stopped out a few times. I was referring to the Supertrend indicator (changed to strategy for backtesting). I don't think this one repaints but it just might be that the coding needs a bit of an adjustment to fire off the signal as close as possible. I recognize it's not the holy grail, none of the indicators/strategies are. What I however do think is possible, is fine tuning it as best as one can so that it minimizes the slippages - note, from the backtest it seems profitable on that timeframe, but then again live trading is different. Will see how it goes.
 
MBF

MBF

Active member
VIP
Warehouse
Thank you for the advice. I've traded with the Trend Reversal and it repaints, it's not bad but you do get stopped out a few times. I was referring to the Supertrend indicator (changed to strategy for backtesting). I don't think this one repaints but it just might be that the coding needs a bit of an adjustment to fire off the signal as close as possible. I recognize it's not the holy grail, none of the indicators/strategies are. What I however do think is possible, is fine tuning it as best as one can so that it minimizes the slippages - note, from the backtest it seems profitable on that timeframe, but then again live trading is different. Will see how it goes.
I haven’t brought that one out in a while. Maybe take another go at it this weekend. Can’t remember why I archived it. Though I am trying to only focus on one or two strats right now. I have a tendency to bury myself in strategies.
Look forward to your testing!
 
M

Miket

Member
How do you guys backtest a strategy on ThinkorSwim? I'd like to take a look at the results for the Sequence Counter found in TOS.
 

Top