NexusFi: Find Your Edge


Home Menu

 





Day Trade Script Backtesting Questions


Discussion in ThinkOrSwim

Updated
    1. trending_up 2,149 views
    2. thumb_up 0 thanks given
    3. group 1 followers
    1. forum 0 posts
    2. attach_file 0 attachments




 
Search this Thread

Day Trade Script Backtesting Questions

  #1 (permalink)
ArbitrageCapital
San Francisco
 
Posts: 1 since Mar 2016
Thanks Given: 0
Thanks Received: 0

Hi All,

I want to write a code that allows me to backtest a day trading strategy. To be specific, I am concerned with just the first 4 bars of each trading day using the 10 minute bar (09:30 - 10:00). The issue I have is the code I have will produce meaningful results if I ran the code today for todays trading session but If I ran the code today for yesterdays price action, the code won't produce meaningful results. I think the issue is with the date parameter?

How can I adjust the code such that the code will only look at the price action of the 0930, 0940, 0950, and 10:00
bar for any trading day? Ideally, I'd like to just change the date parameter when I do my backtesting.


Here is my code. Its a simple inside bar setup. I want to be able to back test the code for day trades using the 10 minute bar. Thanks!


Input Bar_1 = 3;
Input Bar_2 = 2;
Input Bar_3 = 1;
Input Bar_4 = 0;


Input Vol = Volume;
Input Price = Close;
Input High_P = High;
Input Low_P = Low;


Input Length = 26;
Input Increase = 50;

Def AVG_Vol = average(Vol, Length);
Def Change_Vol = 100*(Vol[Bar_1] / Avg_Vol - 1);


Def RegularMarketHours = secondsFromTime(930) >= 0 and secondsTillTime(1600)>=0;

Def TradingDay = GETYYYYMMDD() ;

Plot Scan;


Scan =


Price[Bar_4] < High_P[Bar_1]
and Price[Bar_4] > Low_P[Bar_1]

and Price[Bar_3] < High_P[Bar_1]
and Price[Bar_3] > Low_P[Bar_1]

and Price[Bar_2] < High_P[Bar_1]
and Price[Bar_2] > Low_P[Bar_1]

and Change_Vol > Increase
AND RegularMarketHours
AND TradingDay


;

Reply With Quote




Last Updated on March 11, 2016


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts