I spent 2 Weeks back testing took forever - And if I want to change one small thing I would be back to 2 weeks back testing. I also plan on setting up a bearish market version. Just new to scripting the whole thing. Once I can see how the above script would work then I should have no issues.If price is above the 200 SMA and Under 30 RSI Buy - (Buy Conditions)
If RSI is over 40 or after 10 Trading days Sell -(Sell Conditions)
If price is above the 200 SMA and Under 30 RSI Buy - (Buy Conditions)
If RSI is over 40 or after 10 Trading days Sell -(Sell Conditions)
input HowManyDays = 10;
def CountDays = if variable_name != 0 then 1 else 0;
plot TriggerMaxDays = if sum(CountDays, HowManyDays) == HowManyDays then 1 else 0 ;
input rsi_length = 10 ;
def rsi = reference RSI("length" = rsi_length)."RSI" ;
# ########################################################
def BuyCriteria =
#If price is above the 200 SMA
close > MovAvgExponential("length" = 200)."AvgExp" and
#WHILE the RSI is under 30.
rsi is less than 30 ;
def SellCriteria =
#If RSI is over 40
rsi is greater than 40 ;
# ########################################################
#Order Management
AddOrder(OrderType.BUY_AUTO, BuyCriteria, tickcolor = Color.YELLOW, arrowcolor = Color.BLACK, name = "Buy", tradeSize = 100);
AddOrder(OrderType.SELL_TO_CLOSE, SellCriteria, tickcolor = Color.PINK, arrowcolor = Color.RED, name = "sell", tradeSize = 100);
# ########################################################
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
D | how to complete simple trend following strategy backtest | Questions | 1 | |
![]() |
Help complete this FE and Hurst Exp. coding request? | Questions | 21 | |
H | Bond Market, vague ideas for a noob? | Questions | 1 | |
![]() |
NOOB's 1st Strategy | Questions | 2 | |
I | Need help with ATH script | Questions | 1 |
Start a new thread and receive assistance from our community.
useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.
We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.
If you are new, or just looking for guidance, here are some helpful links to get you started.