Simple HMA Strategy - NinjaTrader Programming | futures io social day trading
futures io futures trading


Simple HMA Strategy
Updated: Views / Replies:2,443 / 5
Created: by honkin Attachments:0

Welcome to futures io.

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

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

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

Reply
 
Thread Tools Search this Thread
 

Simple HMA Strategy

  #1 (permalink)
Just starting out...
Melbourne, Australia
 
Futures Experience: Intermediate
Platform: NinjaTrader, Metatrader
Favorite Futures: EUR/AUD
 
Posts: 13 since Dec 2010
Thanks: 4 given, 2 received

Simple HMA Strategy

Hi

I am extremely new to Ninja Script, so please have a little patience with me. I want to attempt to do it without using the wizard. I based what I am doing on one of Mike's video tutorials.

Basically, I want a simple HMA strategy that enters long on rising HMA and enters short on falling HMA. Naturally, when entering long, any short position would need to be closed and vice versa. I believe that EnterLong() will do the reverse without having to first exit the short position.

I want to be able to run it through the optimiser, so want to be able to allow it to alter the HMA. My preference is to run it on a 1 day chart using HMA(40) but am happy to let the optimiser do its job.

I initially set my variable, which is the HMA:

private int hmalength = 40;

The next 2 sections look like this:

protected override void Initialize()
{
CalculateOnBarClose = true;
EntryHandling = EntryHandling.UniqueEntries;
}

/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>


protected override void OnBarUpdate()
{
EntryHandling = EntryHandling.UniqueEntries;

HMA hmav = HMA(HMAlength);

//ManageOrders();

if ((Position.MarketPosition == MarketPosition.Long) && Falling(hmav))
EnterShort();

else if ((Position.MarketPosition == MarketPosition.Short) && Rising(hmav))
EnterLong();

Lastly, under properties, I have:

[Description("")]
[GridCategory("Parameters")]
public int HMAlength
{
get { return hmalength; }
set { hmalength = Math.Max(1, value); }
}

When I compile this, I get no errors, which is always a good sign. When I open the Strategy Analyser and alter any variables, I get an error message when I select an optimisation method. The error window says:

"Unable to retrieve type intos from assembly '1f9fb650f5264307ae7d5ce95e24f7e5'
System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
at System.Reflection.Module._GetTypesInternal(StackCrawlMarkstacMack)

If I run the optimisation using just the default optimization, I get no trades. In output window also shows no activity.

Can anyone say what I am doing wrong, or do I need to reinstall my NT7, as I get the same message running an optimisation on one of NTs preset strategies?

cheers

honkin

Reply With Quote
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

 
  #3 (permalink)
Site Administrator
Manta, Ecuador
 
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
 
Big Mike's Avatar
 
Posts: 46,238 since Jun 2009
Thanks: 29,350 given, 83,218 received



honkin View Post
Can anyone say what I am doing wrong, or do I need to reinstall my NT7, as I get the same message running an optimisation on one of NTs preset strategies?

Well the last line means it could be any strategy causing this problem. To know for sure if it is this strategy, what you need to do is go to your Documents\NinjaTrader\bin\custom\Strategy folder, locate the .cs file for this strategy, and temporarily move it out of that folder (like to your Desktop).

Then recompile something in Ninja, and see if you still get the error using a built-in strategy.

If so, you might also look at your trace log in the Documents\NinjaTrader folder, to see if it is helpful in telling you which strategy is the problem. Otherwise you might look to remove all the custom strategies (and possibly indicators) out of your installation using the method above until you can find the one causing the problem.

Have you asked NT support for help on this?

Mike

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
6)
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

Reply With Quote
The following user says Thank You to Big Mike for this post:
 
  #4 (permalink)
Elite Member
Near the BEuTiFULL Horse Shoe
 
Futures Experience: Beginner
Platform: NinjaTrader
Broker/Data: MBTrading Dukascopy ZenFire
Favorite Futures: $EURUSD when it is trending
 
Trader.Jon's Avatar
 
Posts: 500 since Jul 2009
Thanks: 401 given, 176 received


honkin View Post
Hi

I am extremely new to Ninja Script, so please have a little patience with me. I want to attempt to do it without using the wizard. I based what I am doing on one of Mike's video tutorials.
//ManageOrders();

if ((Position.MarketPosition == MarketPosition.Long) && Falling(hmav))
EnterShort();

else if ((Position.MarketPosition == MarketPosition.Short) && Rising(hmav))
EnterLong();
If I run the optimisation using just the default optimization, I get no trades. In output window also shows no activity.

Can anyone say what I am doing wrong, or do I need to reinstall my NT7, as I get the same message running an optimisation on one of NTs preset strategies?

cheers

honkin

If you are short and do a enter long, I think you will only flatten ... try this ..

if ((Position.MarketPosition == MarketPosition.Short) && Rising(hmav))
ExitShort();
EnterLong();

or

if ((Position.MarketPosition == MarketPosition.Flat) && Rising(hmav))
EnterLong();

Hope it helps,
Jon

Reply With Quote
 
  #5 (permalink)
Just starting out...
Melbourne, Australia
 
Futures Experience: Intermediate
Platform: NinjaTrader, Metatrader
Favorite Futures: EUR/AUD
 
Posts: 13 since Dec 2010
Thanks: 4 given, 2 received


Trader.Jon View Post
If you are short and do a enter long, I think you will only flatten ... try this ..

if ((Position.MarketPosition == MarketPosition.Short) && Rising(hmav))
ExitShort();
EnterLong();

or

if ((Position.MarketPosition == MarketPosition.Flat) && Rising(hmav))
EnterLong();

Hope it helps,
Jon

cheers Jon. Not saying this is incorrect, but conflicting advice from the NT forum indicated it would actually reverse the trades.

I initially had it as you have shown, but one of the mods at the forum showed me the code as you have seen it.

cheers

honkin

Reply With Quote
The following user says Thank You to honkin for this post:
 
  #6 (permalink)
Just starting out...
Melbourne, Australia
 
Futures Experience: Intermediate
Platform: NinjaTrader, Metatrader
Favorite Futures: EUR/AUD
 
Posts: 13 since Dec 2010
Thanks: 4 given, 2 received


Trader.Jon View Post
If you are short and do a enter long, I think you will only flatten ... try this ..

if ((Position.MarketPosition == MarketPosition.Short) && Rising(hmav))
ExitShort();
EnterLong();

or

if ((Position.MarketPosition == MarketPosition.Flat) && Rising(hmav))
EnterLong();

Hope it helps,
Jon

Hi Jon

The same mod from NT just replied to me saying that he thinks the correct code to enable the trade to reverse is this:

"please remove your MarketPosition checks in the entry conditions then you should see it trigger trades -

if (Falling(hmav))
EnterShort();

if (Rising(hmav))
EnterLong();

"The Enter() method does reverse for you if needed"

Not really sure what he means by "The Enter () does reverse for you if needed". How does NT know what I need and why wouldn't it just flatten instead of reversing? Mmm!

Not sure, but guess I will just do some testing to see.

cheers Jon

Reply With Quote

Reply



futures io > > > > > Simple HMA Strategy

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Linda Bradford Raschke: Reading The Tape

Elite only

Adam Grimes: TBA

Elite only

NinjaTrader: TBA

January

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Please help with simple strategy with SMA dimkrinichnyi NinjaTrader Programming 17 November 1st, 2011 02:25 PM
Simple RSI Strategy frostengine NinjaTrader Programming 2 October 30th, 2011 01:12 PM
Need Help with simple strategy on canceling orders floyd084 NinjaTrader Programming 2 February 22nd, 2011 02:34 AM
Simple strategy vast NinjaTrader Programming 19 August 5th, 2010 06:39 PM
Need help writing a simple strategy soumi71 The Elite Circle 4 November 17th, 2009 01:05 PM


All times are GMT -4. The time now is 11:04 PM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, 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
Page generated 2017-12-11 in 0.13 seconds with 19 queries on phoenix via your IP 54.145.16.43