StockFetcher Forums · Filter Exchange · An attempt at a backtest script<< >>Post Follow-up
graftonian
1,089 posts
msg #154445
Ignore graftonian
10/26/2020 11:12:06 PM

Fetcher[
/* Performance since buy, a crude attempt at a backtest code*/
chart-time is 1 year
market is not OTCBB
Average Volume(30) > 1000000
close > 0.50

draw EMA(9) and drawEMA(13)
set{9x13flag, count(EMA(9) crossed above EMA(13), 1)}
draw 9x13flag
/*anything above this line can be changed of shit-canned at will. Insert your favorite filter, symlist, or watchlist. Just be sure, in the nest line, to insert the triggering condition. */
set{DaysSinceTrigger, days(9x13flag equals 1, 100)}
DaysSinceTrigger > 0
add column DaysSinceTrigger
/****buy price is open the next day***/
Set{buyDay, DaysSinceTrigger - 1}
set{BuyPrice, varoffset(open, BuyDay)}
add column buyprice
draw price line at buyprice
/******Performance since buyday****/
set{dlrgain, close - BuyPrice}
add column dlrgain
set{pg1, dlrgain / buyprice}
set{PctGain, pg1 * 100}
add column pctgain
do not draw DaysSinceTrigger
/***exit strategy***/
set{Bailout, count(EMA(9) crossed below EMA(13), 1)}
draw bailout
set{today, close}
draw price line at today
]



graftonian
1,089 posts
msg #154447
Ignore graftonian
10/27/2020 12:35:01 AM

Looking at this filter, after posting same, I thought of an interesting use;
attaching the main body of the code at the end of an existing filter would allow one a quick and easy means of assessing the behavior of the symbol on previous triggers, using the "historical" button

Cheese
1,374 posts
msg #154449
Ignore Cheese
10/27/2020 2:01:22 AM

Excellent tool. Thank you.

StockFetcher Forums · Filter Exchange · An attempt at a backtest script<< >>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.