Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
I am trying to build a simple strategy to backtest: buy if there's been 3 days of consecutive down days ... the problem is, the floatingPL only appears to show the very first buy trade, then it completely ignores all the other signals which don't even show on the chart.
This is what I have on ThinkScript, I would really appreciate it if someone can please help me get this working, to show all the signals on the chart + to work with the FloatingPL - I am not a programmer and really appreciate the help!
Can you help answer these questions from other members on NexusFi?
I don't know how to get TOS to take multiple entries off of the same order. One work around which is kind of cumbersome is to add a separate order that includes "close is less than close 4 days ago", "5 days ago" etc...
If you just want to know results I can run it through tradestation and give you some figures. Just let me know which stocks/symbols you want it tested on as well as start and end dates.
I built an indicator that successfully shows the occurrences on the 1 year daily chart (3 days consecutive down)... maybe as a workaround, we can code the strategy to Buy whenever the custom study is true? I'm not sure how I'd be able to do that, though.
Using the indicator alone (without having this work as a Strategy with FloatingPL) would be very cumbersome to go through the chart of each stock (and for different time periods), and manually try to figure out the P/L and the # of times a buy (after 3 consecutive downs) is actually successful
//Revision
On second thought, I don't think that will work. You need separate lines or code for each order. Each buy command can only open 1 order as far as I am aware.
But then, how is that if you look at MACD Strategy, there are so many buy/sell orders displayed on the chart with the working FloatingPL, while if you look at the code, you'll see there's only one buy and one sell order
Do you have a sell condition? Thinkscript needs a sell condition to exit the position before opening a new long position. It may be easier if you post the whole code.
I don't have a sell, no... I guess if anything I would want to exit at the close of the bar following the buy bar... This is the code:
-----------------
Def x = open is less than close from 1 bars ago and close from 1 bars ago is less than close from 2 bars ago and close from 2 bars ago is less than close from 3 bars ago;
AddOrder(OrderType.BUY_TO_OPEN, x is true, open[-1], 100, Color.YELLOW, Color.YELLOW, "Buy");