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 have very little experience in programming and want to create a very simple trading strategy in MultiCharts.
BUY = If Close (0) > Close (-1) -- buy if close of the current bar is greater than the close of the previous bar AND keep buying if this rule continues i.e. if there are 5 bars in a row each with the close higher than the previous bar then you will have a net LONG 5 lot position.
SELL = If Close (0) < Close (-1) -- sell if close of the current bar is less than the close of the previous bar AND keep selling if this rule continues i.e. if there are 5 bars in a row each with the close lower than the previous bar then you will have a net SHORT 5 lot position.
CLOSE entire LONG position when a SELL signal appears and open a SHORT as per the rule
CLOSE entire SHORT position when a BUY signal appears and open a LONG position as per the rule
I've highlighted two examples in the attached screenshot of how this rule should work.
Default Quantity = 1 lot i.e. every time I open or add to a current position I will only trade 1 lot.
When a reverse signal comes into effect i.e. "Close Longs - Open Short" I would sell off my entire long position and then open 1 position short.
Feedback appreciated.
Thank you
Can you help answer these questions from other members on NexusFi?
Last year I did a video tutorial on creating an advanced NinjaTrader strategy, and you guys liked it. So I thought that since I don't use NT any more it would be a good idea to do the same strategy as an example in EasyLanguage with MultiCharts.
Making progress and I think I've got it after using the Repeat function although I'm still not sure it'll work.
I get an error that I have no idea what it means and don't see the problem (line 8 is the "buy("BTO")..." line).
Help appreciated.
------ Compiled with error(s): ------
Orders cannot be inside a loop.
errLine 8, errColumn 5, errLineEnd 8, errColumnEnd 5
causal study: (Function)
Repeat
.......
Until
Is a loop. You can't put orders inside here.
Remember that this code is processed on EVERY incoming tick, so you would have purchase 1000's