Join useThinkScript to post your question to a community of 21,000+ developers and traders.
Thank you for your fantastic idea.
I have a few questions as I'm very new to ToS scripting. I'm trying to replicate this script in Python to do some backtesting.
So I have a few questions to clarify what some steps are doing. I understand the HMA is a list of HMA values.
def delta = HMA[1] - HMA[lookback + 1];
// ^ this line takes the 3rd from last calculated HMA value and subtracts it from last HMA value. so if HMA was [4,6,10], delta would be 6.
def delta_per_bar = delta / lookback;
// ^ here we will take 6 and divide it by lookback (2). Our delta_per_bar here is 6/2 = 3
def next_bar = HMA[1] + delta_per_bar;
// ^ next HMA value (one we are predicting) is 10+3 = 13
def concavity = if HMA > next_bar then 1 else -1;
// here is where I'm getting confused. How are comparing a list of values (HMA) to one singular value (next_bar)? .. Can you explain what's exactly happening in this step? Are you saying if next bar is great than the last HMA value then its concave up?
Thank you so much @mashume !! That clarified a lot of things. I will share the code once I'm done (and very excited about the volume indicator)
There is some back testing early in this thread. And some discussion of methodology.Hi @mashume how do you backtest this strategy P&L ? I tried AddOrder(OrderType.BUY_AUTO,buy,tickColor = GetColor(6), arrowColor = GetColor(6),name = "test"); and also with sell to exit but it look that when I put this information nothing happens. Thank you!
I'm looking for the same thing.How do I scan for "Buy Confirmed" signal only ? I used the code here to scan for uptrend, but I would like to get in when "Buy confirmed" has been triggered
Appreciated I'm finding this very useful in my trading and the scan would be really helpful@tenacity11 , @chewie76 , @kelso
Lots of good scanner requests. I'm not ignoring you, but I'm kinda swamped with my day job at the moment. I'll see if I can get some code going over the long holiday weekend.
-mashume
plot signal = !IsNaN(Concavity().MA_Min) within 2 bars;
plot orange = !isNaN(Concavity().CCD_I);
plot green = !isNaN(Concavity().CCU_I);
plot orange_or_green = !isNaN(Concavity().CCD_I) or !isNaN(Concavity().CCU_I);
plot signal = if Concavity().concavity == 1
and Concavity().HMA > Concavity().HMA[1]
then 1 else double.nan;
plot signal = !isNaN(Concavity().buy);
Thanks...greatly appreciated...I'm getting an error messageScan code. I'm not posting how to edit scanners right now. This is code to put in the scanner custom filter.
@tenacity11:
Code:plot signal = !IsNaN(Concavity().MA_Min) within 2 bars;
@kelso:
if you've got the most recent version (with mobile support) this is pretty straight forward:
Code:plot orange = !isNaN(Concavity().CCD_I);
or combine them:Code:plot green = !isNaN(Concavity().CCU_I);
Code:plot orange_or_green = !isNaN(Concavity().CCD_I) or !isNaN(Concavity().CCU_I);
if you don't have the most mobile version, you'll need to hack the script to have the 'concavity' be a plot rather than a def, that way you can call it in the condition on your scan...
Code:plot signal = if Concavity().concavity == 1 and Concavity().HMA > Concavity().HMA[1] then 1 else double.nan;
or something like that.
Don't forget to set your timeframes.
@chewie76 and @newtoazure
Can you tell me what you read as a 'buy confirmed' and I can help you with a scanner. if it's just the 'buy' condition then this may work...
Code:plot signal = !isNaN(Concavity().buy);
-mashume
If you're up for digging into the code, the thing you're looking for is the concavity variable. it's 1 when concavity is upward and -1 when downward. It's defined rather than plotted as the code reads now, but you can change that if you want to use it in a scanner. You'd want to include something along the lines of:Dear @mashume,
Is there a definition to a curve up of the HMA line within the study? I'm trying to figure a way to exclude stocks that are curving down.
...
and Concavity().concavity == 1
...
@codydog Are you still using this with the EHMA?We all have favorite MAs, so, I've been running your script with HMA and EHMA, EHMA seems to lead by 1-2 bars, rarely they give opposing signals, but when they both agree on a bar, its like a NASA ignition. Using a setting of H+L/2 and 8,2 on a 1 day, 2min chart.
I think the wide swings many experience in current conditions can be decreased by using a simple trailing stop system and with such low commissions, maybe it makes sense to take smaller peices of the pie and let them add up.
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
S | Exponential Hull Moving Average (EHMA) for ThinkorSwim | Indicators | 8 | |
Safe Hull Moving Average Indicator for ThinkorSwim | Indicators | 3 | ||
Hull Format, Label, Watchlist, Scan for ThinkorSwim | Indicators | 115 | ||
L | A Volume Pressure Moving Average For ThinkOrSwim | Indicators | 15 | |
T | Mega Moving Average For ThinkOrSwim | Indicators | 26 |
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.