StockFetcher Forums · General Discussion · Backtesting using entry and exit point<< >>Post Follow-up
TracerTrader
5 posts
msg #151797
Ignore TracerTrader
4/10/2020 3:59:26 PM

Hi there,

If I have a simple strategy and want to back test it using entry point that is buying into the close and selling at the opening of next day session. Is there anyway to do that?

Any help would be appreciated!

Thanks

xarlor
581 posts
msg #151800
Ignore xarlor
modified
4/11/2020 12:49:45 PM

Say your strategy is to buy at the close if the close is below the lower Bollinger and sell at the open the next day. Here is how you would represent this as a backtest in SF:

Fetcher[
close 1 day ago < Lower Bollinger Band(20,2) 1 day ago

set{ProfitLoss,open - close 1 day ago}

set{PercentChange1,open / close 1 day ago}
set{PercentChange2,PercentChange1 - 1}
set{PercentChange3,PercentChange2 * 100}

add column ProfitLoss {$ Profit/Loss}
add column PercentChange3 {% Profit/Loss}

sort by column 6 descending
]



Edit: Corrected Line 5.

nibor100
1,031 posts
msg #151804
Ignore nibor100
4/12/2020 2:06:48 AM

@ xarlor,

should "set{PercentChange1,open / close}" be

set{PercentChange1,open / close 1 day ago} ?

Thanks,
Ed S.

xarlor
581 posts
msg #151806
Ignore xarlor
4/12/2020 11:43:50 AM

Why yes. Yes it should. Corrected in the original post. Thanks nibor!

Also, the "$" doesn't show up in the column label. I'm not aware of any escape characters on SF to get around this, but it doesn't affect the actual filter.

StockFetcher Forums · General Discussion · Backtesting using entry and exit point<< >>Post Follow-up

*** Disclaimer *** StockFetcher.com does not endorse or suggest any of the securities which are returned in any of the searches or filters. They are provided purely for informational and research purposes. StockFetcher.com does not recommend particular securities. StockFetcher.com, Vestyl Software, L.L.C. and involved content providers shall not be liable for any errors or delays in the content, or for any actions taken based on the content.


Copyright 2022 - Vestyl Software L.L.C.Terms of Service | License | Questions or comments? Contact Us
EOD Data sources: DDFPlus & CSI Data Quotes delayed during active market hours. Delay times are at least 15 mins for NASDAQ, 20 mins for NYSE and Amex. Delayed intraday data provided by DDFPlus


This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.