Hull Ashi Reversal Strategy For ThinkOrSwim

eviholdings

New member
Hi,

I'm looking for a TOS script to do the following. Who can write this for me?

1. Take available funds from an TOS account
2. If TSLA has a HULL moving average with settings of price of close, length of 26 (moves positive).
and Hieken Ashi turns positive. Then buy however many shares of TSLA you can buy with cash available.
3. If TSLA has a HULL moving average with settings of price of close, length of 26 (moves NEGATIVE).
and Hieken Ashi turns NEGATIVE. Then SELL however many shares of TSLA we hold and go to cash.
4. Repeat the process.
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Hi,

I'm looking for a TOS script to do the following. Who can write this for me?

1. Take available funds from an TOS account
2. If TSLA has a HULL moving average with settings of price of close, length of 26 (moves positive).
and Hieken Ashi turns positive. Then buy however many shares of TSLA you can buy with cash available.
3. If TSLA has a HULL moving average with settings of price of close, length of 26 (moves NEGATIVE).
and Hieken Ashi turns NEGATIVE. Then SELL however many shares of TSLA we hold and go to cash.
4. Repeat the process.

this might be something you can start with.
it is a strategy, not a study

Code:
# hull_ashi_revs_strat_00

#https://usethinkscript.com/threads/create-this-custom-strategy.15686/
#Indicator Forums Questions 
#Create This Custom Strategy
#eviholdings  Jun 17, 2023

#I'm looking for a TOS script to do the following. Who can write this for me?

#1. Take available funds from an TOS account
#2. If TSLA has a HULL moving average with settings of price of close, length of 26 (moves positive).
#and Hieken Ashi turns positive. Then buy however many shares of TSLA you can buy with cash available.
#3. If TSLA has a HULL moving average with settings of price of close, length of 26 (moves NEGATIVE).
#and Hieken Ashi turns NEGATIVE. Then SELL however many shares of TSLA we hold and go to cash.
#4. Repeat the process.



def na = Double.NaN;
def bn = BarNumber();

#---------------------
#  hull avg


def price = close;
input ma1_len = 26;
input ma1_type =  AverageType.HULL;
def ma1 = MovingAverage(ma1_type, price, ma1_len);


input show_lines = yes;
plot z1 = if show_lines then ma1 else na;
z1.SetDefaultColor(GetColor(1));
#z1.setlineweight(1);
z1.HideBubble();



#-----------------
# ashi

#stockcharts - ashi
#https://school.stockcharts.com/doku.php?id=chart_analysis:heikin_ashi
# 1. The Heikin-Ashi Close is simply an average of the open, 
# high, low and close for the current period. 
def HA_Close = (open + high + low + close) / 4;


#2. The Heikin-Ashi Open is the average of the prior Heikin-Ashi 
#candlestick open plus the close of the prior Heikin-Ashi candlestick. 
def HA_Open = (HA_Open[1] + HA_Close[1]) / 2;


#3. The Heikin-Ashi High is the maximum of three data points: 
#the current period's high, the current Heikin-Ashi 
#candlestick open or the current Heikin-Ashi candlestick close. 
#HA_High = Maximum of the High(0), HA-Open(0) or HA-Close(0)
def HA_High = Max(high, Max(HA_Open, HA_Close));


#4. The Heikin-Ashi low is the minimum of three data points: 
#the current period's low, the current Heikin-Ashi 
#candlestick open or the current Heikin-Ashi candlestick close.
#HA-Low = Minimum of the Low(0), HA-Open(0) or HA-Close(0)
def HA_Low = Min(low, Min(HA_Open, HA_Close));

#----------------------

def long_buy = (ma1 > ma1[1]) and (HA_Close[1] < HA_Open[1]) and (HA_Close > HA_Open);
def long_sell = (ma1 < ma1[1]) and (HA_Close[1] > HA_Open[1]) and (HA_Close < HA_Open);

def size = 1;
AddOrder(OrderType.BUY_TO_OPEN, long_buy , open[-1], size, color.green, color.green, name = "Open" );
AddOrder(OrderType.SELL_TO_CLOSE, long_sell, open[-1], size, color.red, color.red, name = "close" );

#
 

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
447 Online
Create Post

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

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.

How do I get started?

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.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top