NexusFi: Find Your Edge


Home Menu

 





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 8,224 views
    2. thumb_up 4 thanks given
    3. group 13 followers
    1. forum 19 posts
    2. attach_file 4 attachments




 
Search this Thread

SMA "crossovers"

  #1 (permalink)
kaywai
singapore
 
Posts: 131 since Nov 2009
Thanks Given: 11
Thanks Received: 7

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:	306
Size:	82.3 KB
ID:	5803  
Attached Files
Elite Membership required to download: SMAN225.zip
Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Are there any eval firms that allow you to sink to your …
Traders Hideout
Online prop firm The Funded Trader (TFT) going under?
Traders Hideout
Build trailing stop for micro index(s)
Psychology and Money Management
The space time continuum and the dynamics of a financial …
Emini and Emicro Index
Deepmoney LLM
Elite Quantitative GenAI/LLM
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
59 thanks
Funded Trader platforms
37 thanks
NexusFi site changelog and issues/problem reporting
23 thanks
GFIs1 1 DAX trade per day journal
22 thanks
The Program
19 thanks
  #2 (permalink)
 simulatorboy 
New York, NY
 
Experience: None
Platform: NinjaTrader
Broker: Zen-Fire
Posts: 10 since Dec 2009
Thanks Given: 0
Thanks Received: 12

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
  #3 (permalink)
 
sharky's Avatar
 sharky 
MIAMI,FL
Legendary Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, tradingview
Broker: Private
Trading: Crypto and natural gas
Posts: 1,063 since Jun 2009
Thanks Given: 625
Thanks Received: 3,906


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 NexusFi Trade Journal Reply With Quote
  #4 (permalink)
 
mea109's Avatar
 mea109 
france
 
Experience: Beginner
Platform: nt
Posts: 201 since Oct 2009
Thanks Given: 1,776
Thanks Received: 56

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
  #5 (permalink)
kaywai
singapore
 
Posts: 131 since Nov 2009
Thanks Given: 11
Thanks Received: 7

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
Thanked by:
  #6 (permalink)
Parvesh
Hong Kong
 
Posts: 2 since Nov 2009
Thanks Given: 1
Thanks Received: 0


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
  #7 (permalink)
 
cclsys's Avatar
 cclsys 
Sydney, NS
 
Experience: Intermediate
Platform: Ninja
Broker: Zen-Fire
Trading: TF,S,GC
Posts: 605 since Nov 2009
Thanks Given: 248
Thanks Received: 393

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 NexusFi Trade Journal Reply With Quote
Thanked by:
  #8 (permalink)
 
cclsys's Avatar
 cclsys 
Sydney, NS
 
Experience: Intermediate
Platform: Ninja
Broker: Zen-Fire
Trading: TF,S,GC
Posts: 605 since Nov 2009
Thanks Given: 248
Thanks Received: 393

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 NexusFi Trade Journal Reply With Quote
  #9 (permalink)
Andrew
sea side
 
Posts: 217 since Dec 2009
Thanks Given: 86
Thanks Received: 25

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
  #10 (permalink)
 dancorcal 
Bryant
 
Experience: Master
Platform: NinjaTrader
Broker: AMP/Zen-Fire
Trading: ES
Posts: 4 since Dec 2009
Thanks Given: 1
Thanks Received: 1


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



Reply With Quote




Last Updated on December 31, 2009


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts