2 signals on entry for strategies

tom409

New member
Plus
Any advice very much appreciated.
How do you use 2 or more signals for entries or exits.

This produces trades in backtest
#TEST1
def good = MACD() > 0 ;
def bad = MACD() < 0 ;

def buy = good ;
def sell = bad;

AddOrder(OrderType.BUY_TO_OPEN, buy);
AddOrder(OrderType.SELL_TO_CLOSE, sell);

This does not produce trades in backtest

#Test3
def macrotrendlong = close > SimpleMovingAvg(200);

def good = MACD() > 0 ;
def bad = MACD() < 0 ;

def buy = good and macrotrendlong ;
def sell = bad;

AddOrder(OrderType.BUY_TO_OPEN, buy);
AddOrder(OrderType.SELL_TO_CLOSE, sell);

I have actually tried this with all sorts of indicators and settings. I think most people would agree more than one signal is a good idea
But I can't figure out how get more than one to work.
I also wish there was a strategy library here. It would be helpful to see what others have done and how they solved problems.
Anyway if anyone can show me how to do this I would very much appreciate it. Thank you
 
Did you adjust the following setting?

1748909846657.png
 

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

Thanks I am grateful for any help
Mine looks exactly the same as your example. But I really don't see what affect it could have either way. I am not scaling in. It is just " if (A is true) AND (B is true) then do X.
It should be very simple

It shouldn't be the same if you're trying to have multiple running orders at the same time.

Try to tweak the first figure (increase it) to see if it makes any difference for you.
 
It shouldn't be the same if you're trying to have multiple running orders at the same time.

Try to tweak the first figure (increase it) to see if it makes any difference for you.
I do not have multiple orders running at the same time.

Go long 100 shares IBM when IBM is above its 200 day moving average AND the MACD is above the Zero line.

That is 1 (one) order. The entry has 2 criteria.

Thanks for trying though. This must be some sort of syntax error I am making.
 
I am getting this to work. Although I can't quite explain how.
Mostly I just pasted reams of other peoples code into my strategy and also used reference.
It runs. But is not yet doing what I want.
Thanks to anyone who even glanced at the tread
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
493 Online
Create Post

Similar threads

Similar threads

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