SMA "crossovers" - futures io
futures io



SMA "crossovers"


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one dancorcal with 4 posts (0 thanks)
    2. looks_two gabga100 with 3 posts (2 thanks)
    3. looks_3 kaywai with 2 posts (1 thanks)
    4. looks_4 cclsys with 2 posts (1 thanks)
    1. trending_up 6,628 views
    2. thumb_up 4 thanks given
    3. group 13 followers
    1. forum 19 posts
    2. attach_file 4 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • 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 and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

 
Search this Thread
 

SMA "crossovers"

(login for full post details)
  #1 (permalink)
kaywai
singapore
 
 
Posts: 131 since Nov 2009
Thanks: 11 given, 7 received

Hi, I'm trying to create a script to initiate a long position when the fast MA crosses two other slower MAs. The problem I have when using the "crossabove" or "crossbelow" is that trades are initiated when the crossover occurs over 1 bar. Likewise for the exit. By default however, it will exit on close. It will not initiate or exit a position if the crossover occurs over a few bars.
The attached chart show a long position at approx 9:37 when the green lines crosses above the red and orange lines. But at approximately 11.57, when the green line crosses below the other 2 lines, it should exit. Instead it exits on close. Would anybody be able to assist?

Attached Thumbnails
Click image for larger version

Name:	NIA 02-10  11_27_2009 (7 Min).jpg
Views:	240
Size:	82.3 KB
ID:	5803  
Attached Files
Register to download File Type: zip SMAN225.zip (4.0 KB, 31 views)
Reply With Quote

Can you help answer these questions
from other members on futures io?
Anybody uses Bookmap with Tradestation?
TradeStation
Multichart NET: where can i find esplanation on CustomIn …
MultiCharts
Needing harmonic patterns indicator
TradeStation
Need help with strategy PriceActionSwingPro
NinjaTrader
options data for chart
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on futures io
I finally blew up an account
58 thanks
Spoo-nalysis ES e-mini futures S&P 500
40 thanks
FIO Journal Challenge - April 2021 w/Jigsaw Trading
38 thanks
The Crude Dude Oil Trading System
37 thanks
The tiyfTradePlanFactory indicator
25 thanks
 
(login for full post details)
  #2 (permalink)
 simulatorboy 
New York, NY
 
Experience: None
Platform: NinjaTrader
Broker: Zen-Fire
 
Posts: 10 since Dec 2009
Thanks: 0 given, 12 received

From what I can see, the problem is that your logic is looking for both crossovers to happen on the same bar. What you need to do is use one crossover as a trigger (using the actual crossover keyword) and another as a filter (by just checking that the value is higher or lower).

Hope that makes sense.

Reply With Quote
 
(login for full post details)
  #3 (permalink)
 sharky 
MIAMI,FL
 
Experience: Advanced
Platform: NinjaTrader
Broker: Private
Trading: Zn,6E,6J
 
sharky's Avatar
 
Posts: 1,060 since Jun 2009
Thanks: 624 given, 3,900 received


if you try to trade crossovers you will blow your account if it was a good method of trading everyone would do it trust me just look in another direction to trade it wont help you ...sharky

KILLING THE MARKETS DAILY
Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #4 (permalink)
 mea109 
france
 
Experience: Beginner
Platform: nt
 
mea109's Avatar
 
Posts: 201 since Oct 2009
Thanks: 1,776 given, 56 received

hello Kaywai confirms what I said sharky dangerous trader crosses SMA I left feathers
and in case of bonjour range market disaster

Reply With Quote
 
(login for full post details)
  #5 (permalink)
kaywai
singapore
 
 
Posts: 131 since Nov 2009
Thanks: 11 given, 7 received

Guys, your comments are noted and appreciated. Thanks. The initial question i posed allows me to 1) learn how to write the code for similar stuff which I have very little idea how to at the moment and 2) see how the strategy works in asia.

Hope you understand.

Reply With Quote
The following user says Thank You to kaywai for this post:
 
(login for full post details)
  #6 (permalink)
Parvesh
Hong Kong
 
 
Posts: 3 since Nov 2009
Thanks: 1 given, 0 received


sharky View Post
if you try to trade crossovers you will blow your account if it was a good method of trading everyone would do it trust me just look in another direction to trade it wont help you ...sharky

Does that mean one should refrain from automated trading with crossovers? May be it
varies from instrument to instrument as I know someone who has been trading
different types of crossovers with very good end results.

Reply With Quote
 
(login for full post details)
  #7 (permalink)
 cclsys 
Sydney, NS
 
Experience: Intermediate
Platform: Ninja
Broker: Zen-Fire
Trading: TF,S,GC
 
cclsys's Avatar
 
Posts: 607 since Nov 2009
Thanks: 248 given, 392 received

kaywai: crossover has problems like that. I ended up coding it manually like:

if MAfast[1] < MAslow[1] and MAfast[0] > MAslow[0] then that's an upcross.

In terms of crossovers in general: if you are trading generally trending markets they work well. In high-volume heavily institutional markets this often doesn't work out since the chops eat up the winners. But there are many markets out there which do trend nicely.

Thing is: those that do trend nicely you can probably get the same results with simple turtle-trading style, i.e. buy higher highs and sell lower lows. Throw up a Donchian or two and see if this is true or not.

Another classic approach - again with markets which tend to trend - and which uses MA's:

Let's say you have a slow MA for the LT trend, like a Weekly 20 EMA = 100 Daily (5*), or if you are intraday it's the same principle: something quite slow for LT trend (I find 63-ish is often good = 3* 21).

Then any time that weekly/LT is long, say, and the ST Stochastic (say 21) crosses up from underneath the 20 level, you got yourself a good-looking pullback. Very simple, but quite effective. In this case the trick is not so much in the system as
a) picking strong trending markets (no mean trick, although I suspect many Asian instruments do trend strongly since you guys are in boom times like the US in the late 1800's - late 1920's and your boom is MUCH bigger than ours since you are starting with over 1.4 billion people and the US had less than 100 million).
b) money management in terms of loss and trailing stops, multiple scaleouts etc.

Good luck!

Visit my futures io Trade Journal Reply With Quote
The following user says Thank You to cclsys for this post:
 
(login for full post details)
  #8 (permalink)
 cclsys 
Sydney, NS
 
Experience: Intermediate
Platform: Ninja
Broker: Zen-Fire
Trading: TF,S,GC
 
cclsys's Avatar
 
Posts: 607 since Nov 2009
Thanks: 248 given, 392 received

Just for fun, I picked a trending market: Crude.
Since it seems you are trading in Asia I threw up:
1) LT Ichimoku Kinkyo Ho clouds, which use medians from 27 to 81. If price is above clouds = bull mkt. Simple.
2) ST Stochastics from NT basic indicators.
3) For fun: an oscillator derived from the Ichimoku fast and slow lines also in above chart (red and green) which give added medium term info; the indy is designed to help with trend trading but is slower than the stochs and the buy areas tend to be in crosses above zero versus from down below, i.e. above zero is bullish and below zero is bearish.
4) Ichimoku Kinkyo Ho Lines (Donchian Medians 9 and 27). Developed in the 1960's I believe (before computers). Still solid. The clouds are VERY Japanese and VERY helpful (drawn 81 bars before current price action, i.e. they predict probable future price. If price is above this prediction, it's bullish.)

As you can see, in a strong trending market, buying pullbacks works pretty well. Probably your crossing MA's are doing the same thing on some level.

They have to. Why: if market is not strongly trending, MA cross strategies get chewed to bits.
If you are making money in trending markets you must be getting on board (somehow) and staying along for the ride long enough to more than make out for the losing entries. So the cheapest way to get in is on pullbacks. The most momentum-rich way is on breakouts (that work). MA crosses tend to do one or the other depending on how they are configured, but no matter the indicator if you are buying into a strongly trending bull market, it doesn't really matter the entry technique: the strongly trending market will take care of it for you!

The real issue is: what happens when it's not strongly trending? Are you ceasing to trade that instrument? If so, no worries. But if you are trading it all the time no matter what, it's going to be a very sophisticated MA technique that will come away with net gains over time.



Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #9 (permalink)
Andrew
sea side
 
 
Posts: 217 since Dec 2009
Thanks: 86 given, 25 received

my 2 cents about MAs crossovers.
Agree with Sharky trading based solely on crossovers seems not quite good way, but...
big difference how you use that crossovers.
For example, if you wait for crossover and then enter as per that crossover, that one way
if you wait for crossover and then enter on the pull back from "longer" MA in your crossover that's another way.
Not brilliant idea, because apart from that better to have some meaningful levels supports that pullback, but it helps me to see some picture.
+ pullbacks from "longer" MA works only when price reach that first time, at least second time on third it usually not pullsback from that "longer" MA.
I've noted also that simply crossover of 10 SMA and 10 EMA shows quite interesting levels intraday, but not deepen yet in to that enough.
+ also quite important seems what MAs used for crossovers.

P.s. if any I will be glad to discuss further that issue

Reply With Quote
 
(login for full post details)
  #10 (permalink)
 dancorcal 
Bryant
 
Experience: Master
Platform: NinjaTrader
Broker: AMP/Zen-Fire
Trading: ES
 
Posts: 4 since Dec 2009
Thanks: 1 given, 1 received


Crossover can be profitable. He is one I use with discretion, backtested to 2003.



Reply With Quote
 
(login for full post details)
  #11 (permalink)
 gabga100 
New York
 
Experience: Advanced
Platform: NT
 
gabga100's Avatar
 
Posts: 147 since Nov 2009
Thanks: 44 given, 70 received


dancorcal View Post
Crossover can be profitable. He is one I use with discretion, backtested to 2003.




Nice equity curve ......your exits must be really good ....

You know what you know but you do not know what you do not know.
You do not see things how they are, you see things how you are.
In life you do what you want but you do not want what you want.
Reply With Quote
 
(login for full post details)
  #12 (permalink)
 CDesai13 
NA
 
Experience: Intermediate
Platform: IRT
 
CDesai13's Avatar
 
Posts: 46 since Jun 2009
Thanks: 29 given, 18 received

The equity curve went sharply negative early, on top of that, there are no commissions factored in. This would support Sharky's comments that you'll blow out the account before you would ever be profitable long term.

Reply With Quote
 
(login for full post details)
  #13 (permalink)
 dancorcal 
Bryant
 
Experience: Master
Platform: NinjaTrader
Broker: AMP/Zen-Fire
Trading: ES
 
Posts: 4 since Dec 2009
Thanks: 1 given, 1 received

Worst DD was only 3900, so not too sharp early. Also it took 1310 trades total since 2003 so commission at $5 would not eat it up.

Reply With Quote
 
(login for full post details)
  #14 (permalink)
 gabga100 
New York
 
Experience: Advanced
Platform: NT
 
gabga100's Avatar
 
Posts: 147 since Nov 2009
Thanks: 44 given, 70 received


CDesai13 View Post
The equity curve went sharply negative early, on top of that, there are no commissions factored in. This would support Sharky's comments that you'll blow out the account before you would ever be profitable long term.

Based on my experience crossovers can be profitable but you need

1) strong filters ...e.g. always trade in the 100-200 daily MA slope or only trade if the intra-day gap is > a certain amount
2) non-related Crossover exits techniques
3) Strong cross : The bigger the length the MA is crossed by the price ,the bigger the chances of a profitable trade, unfortunately the length of these MA are not compatible with day-trading time frames (in and out same days )
4) forecasting choppy days as these pull 100 un-profitable trades..


What I do not understand is why would you want to automate such strategies if you can easily replicate these by discretionary trading .... Human Eye still the best for low-frequency trading
...

You know what you know but you do not know what you do not know.
You do not see things how they are, you see things how you are.
In life you do what you want but you do not want what you want.
Reply With Quote
The following 2 users say Thank You to gabga100 for this post:
 
(login for full post details)
  #15 (permalink)
Andrew
sea side
 
 
Posts: 217 since Dec 2009
Thanks: 86 given, 25 received

Dancorcal,
Is that secret what crossover you are using ?
Krgds,
Andrew

Reply With Quote
 
(login for full post details)
  #16 (permalink)
 dancorcal 
Bryant
 
Experience: Master
Platform: NinjaTrader
Broker: AMP/Zen-Fire
Trading: ES
 
Posts: 4 since Dec 2009
Thanks: 1 given, 1 received

I agree, I don't automate this. Also since the backtested results wait for the bar to close, I get much better fills in real time, I also use s/r levels to help with exits, but the tested strategy is just an end of day exit, and has out performed all the exit strategies I have attempted to automate.

Reply With Quote
 
(login for full post details)
  #17 (permalink)
piersh
California
 
 
Posts: 87 since Jun 2009
Thanks: 5 given, 119 received


dancorcal View Post
Crossover can be profitable. He is one I use with discretion, backtested to 2003.

nice. it looks like you're getting about one trade every 2 days on a 10-minute chart, and you're in the market about 15% of the time (presuming you're not trading after-hours). is that about right?

Reply With Quote
 
(login for full post details)
  #18 (permalink)
 gabga100 
New York
 
Experience: Advanced
Platform: NT
 
gabga100's Avatar
 
Posts: 147 since Nov 2009
Thanks: 44 given, 70 received


piersh View Post
nice. it looks like you're getting about one trade every 2 days on a 10-minute chart, and you're in the market about 15% of the time (presuming you're not trading after-hours). is that about right?


It looks good .... but optimizations are really far from reality .... it can be fitted ....

Is this a Walk-forward optimization or a simple optimization ?


With many parameters and a good Genetic optimizer , everybody can pull-out results like that.... even for 6 years .....

You know what you know but you do not know what you do not know.
You do not see things how they are, you see things how you are.
In life you do what you want but you do not want what you want.
Reply With Quote
 
(login for full post details)
  #19 (permalink)
 dancorcal 
Bryant
 
Experience: Master
Platform: NinjaTrader
Broker: AMP/Zen-Fire
Trading: ES
 
Posts: 4 since Dec 2009
Thanks: 1 given, 1 received

Just simple optimization, ran the walk forward and still looks good (I think), not sure how to post the results though, since they are not summarized, so attaching as xls. Only has 2 parameters and stop loss.

Attached Files
Register to download File Type: xls NinjaTrader.xls (48.0 KB, 35 views)
Reply With Quote
 
(login for full post details)
  #20 (permalink)
 shodson 
Quantoholic
OC, California, USA
 
Experience: Advanced
Platform: IB/TWS, NinjaTrader, ToS
Broker: IB, ToS, Kinetick
Trading: stocks, options, futures, VIX
 
shodson's Avatar
 
Posts: 1,962 since Jun 2009
Thanks: 529 given, 3,655 received


kaywai View Post
Hi, I'm trying to create a script to initiate a long position when the fast MA crosses two other slower MAs. The problem I have when using the "crossabove" or "crossbelow" is that trades are initiated when the crossover occurs over 1 bar. Likewise for the exit. By default however, it will exit on close. It will not initiate or exit a position if the crossover occurs over a few bars.
The attached chart show a long position at approx 9:37 when the green lines crosses above the red and orange lines. But at approximately 11.57, when the green line crosses below the other 2 lines, it should exit. Instead it exits on close. Would anybody be able to assist?

I've seen problems with using CrossAbove() and CrossBelow() myself as well in NT, I use cclsys's approach if I'm looking for some sort of cross over.

Follow me on Twitter Visit my futures io Trade Journal Reply With Quote


futures io Trading Community Platforms and Indicators NinjaTrader > SMA "crossovers"


Last Updated on December 31, 2009


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing

HIRO Indicator by Spotgamma in Bookmap w/Brent Kochuba @ SpotGamma

Elite only

NEW BlackBird Features + FOREX Support w/Jeremy Tang @ SharkIndicators

Elite only
     



Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada), info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts