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)
Looks like you commented out the code for some reason - either way, welcome to the adventure...
Your code as was wouldn't compile on MultiCharts for a variety of reasons; tweaked variant below at least now compiles (for starters you can't/shouldn't mix indicator calls with signal code):
...but I'm not sure exactly what you're trying to accomplish (exactly), i.e.
do you want to always be "in the market" but keep flipping buy/sell whenever the color changes?
is it safe to assume you're willing to wait until a bar closes before making buy/sell decisions? (i.e. intrabar, the color may change multiple times in either direction in whipsaw fashion)
not sure if the above was meant to be "entry-only" signals in which case you need additional code for managing exits (i.e. check for "MarketPosition = 0")
the above is long-only entry-wise - will need a bit more tweaking depending on what you're actually trying to accomplish
My .02...backtesting the above with a single NQM0 contract for the past month netted $110k ($977k GP, -$867 GL; not my cup of tea as W/L ratio is only 34% but I suppose you could technically live on $1M+/year)
I am not sure how I did that. I was trying to add more comments. I will fix it. Thank you for the help. Also I am on tradestation will this work there?
I am not sure how I did that. I was trying to add more comments. I will fix it. Thank you for the help. Also I am on tradestation will this work there?
No worries - we all have to start somewhere . I've spent 30+ years in IT (and about 20 trading) so I had the advantage of a Computer Science background to start with.
FYI, MultiCharts was written by some of the developers that wrote TradeStation hence the parallels with EasyLanguage syntax so most code should be interchangeable (TS does support OO which I with MC had). TradeStation is better in some ways, not so much in others, but either is easier to code strategies and indicators on than having to write something object oriented in C# or Java IMHO (e.g. NinjaTrader, etc.). I've been doing more coding of late in Python...
That being said, just don't get caught chasing the holy grail - backtesting strategies is only one part of a workable system (and be wary of results using if Heikin-Ashi, Renko, etc. bar types). Also, the operational side of having to deal with "hiccups" can take up as much code as the strategies themselves (done properly anyway) so there's value with testing against demo/paper accounts before losing (I mean making) real $$$ .
No worries - we all have to start somewhere . I've spent 30+ years in IT (and about 20 trading) so I had the advantage of a Computer Science background to start with.
FYI, MultiCharts was written by some of the developers that wrote TradeStation hence the parallels with EasyLanguage syntax so most code should be interchangeable (TS does support OO which I with MC had). TradeStation is better in some ways, not so much in others, but either is easier to code strategies and indicators on than having to write something object oriented in C# or Java IMHO (e.g. NinjaTrader, etc.). I've been doing more coding of late in Python...
That being said, just don't get caught chasing the holy grail - backtesting strategies is only one part of a workable system (and be wary of results using if Heikin-Ashi, Renko, etc. bar types). Also, the operational side of having to deal with "hiccups" can take up as much code as the strategies themselves (done properly anyway) so there's value with testing against demo/paper accounts before losing (I mean making) real $$$ .
Best of luck!
LOL thanks.
Is there anyway to make it execute a trade multiple times in a candle if the color keeps changing? Like when the hull line would start to flicker I want it to execute the sell or buy.
Is there anyway to make it execute a trade multiple times in a candle if the color keeps changing? Like when the hull line would start to flicker I want it to execute the sell or buy.
Technically - yes, though I wouldn't recommend it. Look up "Intrabar Order Generation" on either TradeStation or MultiCharts; typically signals are generated only at the close/end of each bar though that can be adjusted (either at compilation or run-time) to be tick-by-tick-based.
The issue you'll run into though is order fill time (i.e. slippage) which you need to assume can/will eat up 50ms-5s (or worse) depending on broker, trading server co-location near exchange (or not), etc. I've done some studies in the past where I generated signals based on "commitment level"; i.e. trades within a bar heading predominantly in one direction vs. a continuous "battle" between bulls & bears. Didn't really amount to much from what I recall, at least not with any constancy. Might be something where Machine Learning can be applied with better success but I haven't done enough with ML yet (and integrating ML with retail trading platforms isn't a small task).
Simple tends to work "better" (i.e. more consistently) with the caveat that you also need to understand (and have coded for) market context, money management and general broker/internet-induced gremlins along with whatever signal you're looking for (HMA or otherwise).