NexusFi: Find Your Edge


Home Menu

 





MA cross Buy/Sell Strategy - need help


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one hondo69 with 3 posts (2 thanks)
    2. looks_two SPMCC with 3 posts (0 thanks)
    3. looks_3 RBSailing with 3 posts (1 thanks)
    4. looks_4 lolu with 1 posts (0 thanks)
    1. trending_up 6,839 views
    2. thumb_up 3 thanks given
    3. group 4 followers
    1. forum 11 posts
    2. attach_file 5 attachments




 
Search this Thread

MA cross Buy/Sell Strategy - need help

  #1 (permalink)
SPMCC
Warrenton,va
 
Posts: 3 since Oct 2009
Thanks Given: 0
Thanks Received: 0

I wish i knew enough code to contribute something here. I could program in Trade Station but ninja has me scratching my head. I'm trying to build a simple strategy that can buy or short on a tick above/below an adjacent bar, when it is above or below 2 ma's. I do manually and am missing some ticks. If anyone could get me started, I'd be very grateful.

Happy trading

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
How to apply profiles
Traders Hideout
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
Better Renko Gaps
The Elite Circle
REcommedations for programming help
Sierra Chart
MC PL editor upgrade
MultiCharts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
30 thanks
Spoo-nalysis ES e-mini futures S&P 500
28 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
20 thanks
GFIs1 1 DAX trade per day journal
16 thanks
  #2 (permalink)
 
max-td's Avatar
 max-td 
Frankfurt
 
Experience: Intermediate
Platform: NinjaTrader
Trading: FGBL 6E B4
Posts: 1,752 since Jun 2009
Thanks Given: 2,309
Thanks Received: 927

hi SPMCC,
i think you mean a MA-cross as entry-trigger, is this right ?
can you post us a screenshot of your chart with this setup marked to understand what you mean ?
If you dont know how to code with c#, have you tired it with the ninja strategy-wizard yet ?
have you checked the MA-cross-startegy-example that you have native in your NinjaTrader yet ?

if not, these are some good ways to start this project !

max-td
Reply With Quote
  #3 (permalink)
 
RBSailing's Avatar
 RBSailing 
Palm Beach Gardens
 
Experience: Intermediate
Platform: Ninja Trader
Posts: 21 since Jun 2009
Thanks Given: 5
Thanks Received: 6


hi SPMCC,

The first step in developing your strategy is to define your entry and exit "conditions"
From there you can develop the strategy code.

When defining your conditions you have to name what indicators you are including and the values that they must have to satisfy your condition.

If you can post the conditions I am sure we can help you develop the code.

Follow me on Twitter Reply With Quote
Thanked by:
  #4 (permalink)
SPMCC
Warrenton,va
 
Posts: 3 since Oct 2009
Thanks Given: 0
Thanks Received: 0

Thanks for the replies. What I do manually is wait until 2 or more MA's cross, then wait for a HH or LL. In tradeStation, for longs, I could buy on the next bar's tick above the prev H, or even let it come back a tick or 2, run my stops. But in ninja, I sort of mmade it work via Wizard - but the Wizard is a little sneaky.

Reply With Quote
  #5 (permalink)
 
RBSailing's Avatar
 RBSailing 
Palm Beach Gardens
 
Experience: Intermediate
Platform: Ninja Trader
Posts: 21 since Jun 2009
Thanks Given: 5
Thanks Received: 6

Sounds like a moving average crossover. What indicator or chart pattern are you using for confirmation? I assume you mean HH to be Higher High and LL to mean Lower Low...
There is a moving average cross over script on the NT support site. As for your HH and LL you could submit a stop entry order based on the High or Low of the current or last bar.

I would "test" this condition set carefully before I spent a lot of time coding it. I have worked with MA crossovers before and for me they were not very reliable.

Good luck and let us know how it goes.

Follow me on Twitter Reply With Quote
  #6 (permalink)
 
hondo69's Avatar
 hondo69 
Austin, TX
 
Experience: Intermediate
Platform: NinjaTrader
Trading: Currencies
Posts: 162 since Jun 2009
Thanks Given: 57
Thanks Received: 248

When I've experiment with MA crossovers I've discovered two inherent problems. First, the lag built into most MA's cause issues of missing good entry points. So the trick seems to be to use the lag to your advantage. For example, combining a slow MA like SMA 50 with a faster MA like HMA 16 yields the best results.

Secondly, Ninja strategies only work "on bar close". So if you're trading out of the high of the previous bar (or bars), then you have to wait until the current bar closes. This really messes up a lot of good strategies. For example, if the previous high was 1100 and you want to go long at 1102 then you have a problem. The current bar must trade to 1102 and then close before an entry is made.

You almost have to have 2 charts that "talk to each other" to make the strategy viable. One chart would be short term and the other longer term.

Reply With Quote
  #7 (permalink)
SPMCC
Warrenton,va
 
Posts: 3 since Oct 2009
Thanks Given: 0
Thanks Received: 0

Thanks. That's what I was afraid of. Yes, this strategy will not work on bar-close; it has to be intra-bar. Thanks again for the help.

Reply With Quote
  #8 (permalink)
 
RBSailing's Avatar
 RBSailing 
Palm Beach Gardens
 
Experience: Intermediate
Platform: Ninja Trader
Posts: 21 since Jun 2009
Thanks Given: 5
Thanks Received: 6

Strategies can use the OnMarketUpdate instead of OnBarUpdate.

I also have use a Stop entry order as well. When the current bar closes and my entry conditions have been met but I want to be sure the market is actually moving in the anticipated direction I will set a StopEntry order rather than a Market Order.

Follow me on Twitter Reply With Quote
  #9 (permalink)
 
hondo69's Avatar
 hondo69 
Austin, TX
 
Experience: Intermediate
Platform: NinjaTrader
Trading: Currencies
Posts: 162 since Jun 2009
Thanks Given: 57
Thanks Received: 248

I've had trouble making OnMarketUpdate work with Ninja, but that could just my my system. Maybe I need to go back and see if I can get it to work properly because it would surely change my way of approaching a strategy. Especially for back testing.

When entering, I like to use a stop as a means of entering as well.

Reply With Quote
  #10 (permalink)
 zeller4 
Orlando Florida
 
Experience: Intermediate
Platform: NT8
Trading: CL, NQ, ES, RTY
Posts: 477 since Jun 2009
Thanks Given: 1,416
Thanks Received: 404


RB and/or Hondo,

Are you using NT7? I'm still on v6.5. I looked into OnMarketUpdate and couldn't find it listed in the NT support helpguide. Or maybe I need to use a different link for current methods. If you have a link, please provide.

I've tried stop entries and may just need a little tweaking for error handling. Sometimes I've let my strat run during the night just to test operation and find that it has submitted orders that were subsequently rejected which then stopped the strat.

Do you have a sample of this portion of the code that you could share?

Thanks,

Kirk

Reply With Quote




Last Updated on January 31, 2010


© 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