PDA

View Full Version : EMA Crossover


Rollins
10-26-2007, 02:35 PM
Prints a triangle above or below a bar when 2 EMAs cross.
An extra period for confirmation is configurable, this will introduce more lag though. The triangle will be drawn 2 periods ago from the time it is actually calculated if more confirmation is required, don't forget that when you look at past price action!

Test it don't take my word for its accuracy.

Edit: Triangles are drawn on the chart(thanks to Gumphrie's ModHeikenAshi), dragging is now impossible, added parameter for distance to bar
Edit: v1.2 adjusted for intra bar calculation
Edit: v1.3 colors save correctly now, thanks to Gumphrie again
Edit: v1.4 NT 6.5, can be printed as a plot(1 above, -1 below) OR as triangles for indication, remember to move it to another panel if you go for the plot. Also added, MA type selection. Confirmation removed, it's bugged
Edit: v1.44 Added choice to either plot or draw triangles

buderim
12-12-2007, 06:29 PM
Hi Rollins,

Thanks for the indicator it is very useful.

I am trying to get it to show different colours in Market analyzer.

The idea is I set up Maxover in several timeframes I want the maxover box in each time frame to be coloured depending if the cross is showing long or short trend.

I have added maxover to market analyzer but I cant see how to set the conditions to make the colours change and I wondered if you knew how to ?

Sorry if this is a bit garbled.

Thanks
IAn

Rollins
12-12-2007, 07:07 PM
Thank you buts don't count.

I've added a way how to achive this, but this one has been done on NT 6.5, if it doesn't work on 6.0 you're out of luck (at least if someone else isn't making the changes ).

So here's how you get your desired results, set ShowPlot to true, the indicator should return 1 and -1 now.

Would be probably easier to code a strategy if your system can be automated.
My SignalBars indicator does something similar btw.

Backtest the results, don't take my word for it.

buderim
12-12-2007, 07:16 PM
Thank you buts don't count.

I've added a way how to achive this, but this one has been done on NT 6.5, if it doesn't work on 6.0 you're out of luck (at least if someone else isn't making the changes ).

So here's how you get your desired results, set ShowPlot to true, the indicator should return 1 and -1 now.

Would be probably easier to code a strategy if your system can be automated.
My SignalBars indicator does something similar btw.

Backtest the results, don't take my word for it.

Thanks for the reply.

I will give 6.5 a try.

Ian

Rollins
12-12-2007, 07:19 PM
I've made the 1.4 version a little more efficient for the way you use it.
If you use bar graphs on your market analyzer window, it will be even easier to spot which MA is leading, you need to set the max value to something around 1 though.

A lot of indicators don't have problems on NT 6.0 when exported from 6.5.

Imo 6.5 beta is already very mature and I like the improvements.

buderim
12-12-2007, 07:57 PM
I've made the 1.4 version a little more efficient for the way you use it.
If you use bar graphs on your market analyzer window, it will be even easier to spot which MA is leading, you need to set the max value to something around 1 though.

A lot of indicators don't have problems on NT 6.0 when exported from 6.5.

Imo 6.5 beta is already very mature and I like the improvements.

Hi Rollins,

I really appreciate you making this work .

I have loaded it on 6.5 and it works great.

Many Thanks

Ian

Rollins
12-12-2007, 08:27 PM
Glad that it works for you.

I've removed the confirmation part, it's bugged and didn't add something(prepare to be whipsawed :D).

Also mistakenly set CalculateOnBarClose to false, my bad.

I've also switched the -1 and 1, should be indicating uptrend with 1 and not -1.

art cole
12-13-2007, 06:08 PM
Rollins,

Thank you for the indicator. I will try it with 6.5. Is the correct version to download 1.43 for 6.5?

Art

Rollins
12-13-2007, 07:10 PM
Yep Art, 1.43's been done on 6.5.

buderim
12-27-2007, 08:55 PM
Hi Rollins,

the Ma crossover is working well in market analyzer.

I have been trying to edit the code so I can set one of the moving average parameters to use the bar open price rather than the usual close price.

I am unable to see where I can change it, any clues would be appreciated.

Thanks
Ian

Rollins
12-28-2007, 02:29 AM
Hi Ian,

PriceTypeSupported = false;
Add(new Plot(Color.FromKnownColor(KnownColor.Lime), PlotStyle.Line, "XOver"));
maSlow = MAV( Input, SlowPeriod, (int)SlowMAType );
maFast = MAV( Input, FastPeriod, (int)FastMAType );
either change:

PriceTypeSupported = true;

but this will affect both Input series

or

maSlow = MAV( Input, SlowPeriod, (int)SlowMAType );
maFast = MAV( Open, FastPeriod, (int)FastMAType );


Of course you could also use a combination of both

Cheers

buderim
12-28-2007, 02:52 AM
Hi Ian,

PriceTypeSupported = false;
Add(new Plot(Color.FromKnownColor(KnownColor.Lime), PlotStyle.Line, "XOver"));
maSlow = MAV( Input, SlowPeriod, (int)SlowMAType );
maFast = MAV( Input, FastPeriod, (int)FastMAType );
either change:

PriceTypeSupported = true;but this will affect both Input series

or

maSlow = MAV( Input, SlowPeriod, (int)SlowMAType );
maFast = MAV( Open, FastPeriod, (int)FastMAType );
Of course you could also use a combination of both

Cheers

Thanks for that,

I made the change and it works

Cheers
IAn

dwalls
01-05-2008, 02:22 PM
Thanks for the indicator.
I've noticed that if you set a wide right side margin (for whatever reason) the indicator does not indent with the margin setting...causing the arrows not to line up with the crossovers. Is there any way to have the indicator adjust to whatever right side margin someone might want to set?
So things will line up.

Thanks

Rollins
01-05-2008, 04:17 PM
Dwalls, sorry for the bug. Unfortunately I am no longer using this indicator and have got a lot of things to do, that's why I have no intention to fix it. Maybe someone else will make the necessary changes.

Rollins
01-06-2008, 08:14 AM
I've added the option to chose between plotting and drawing the triangles. Set DrawObjects to true and see if it fixes your issue. I haven't been able to replicate the bug but did a bit of testing, unfortunately I can't dedicate more time to this.
Please post if this fixes your bug or not.

dwalls
01-16-2008, 06:16 PM
That didn't do it, but thanks for your time.

kingfish88
05-21-2008, 04:30 PM
Hi, I know this is a old topic. I hope you still read it. Anyway, I just found a little issue w/ this, but don't know how to correct it.
If I change the chart's right side margin, the triangle still stay in the same place. Any idea? Thx!

Wes

rangerdoc
01-16-2009, 11:44 AM
Can the author or anyone else code this so that different params (i.e. open, close, medial, typical) can be used for each ema?
My strategy uses a cross of a 6ema(open) with a 5ema(close).

Thanks.

NinjaTrader_Bertrand
01-16-2009, 11:51 AM
Hi rangerdoc, hopefully somebody from the community will chime in and help you on your request.

If you want to give a try yourself, please check out our indicator coding tutorials - http://www.ninjatrader-support.com/HelpGuideV6/Overview18.html

For professional NinjaScript programming, you can check this link - http://www.ninjatrader.com/webnew/partners_onlinetrading_NinjaScript.htm

rangerdoc
01-27-2009, 01:09 AM
I got it to do what I needed based on the script in post #12.

Thanks.

Greenmoney21
07-15-2009, 11:34 AM
How do i add a sound alert to this indicator?

Thank you..

NinjaTrader_Austin
07-15-2009, 11:38 AM
MoneyMate8, thank you for the question. Have you seen the PlaySound() method (http://www.ninjatrader-support.com/HelpGuideV6/helpguide.html?PlaySound)?

Greenmoney21
07-15-2009, 11:54 AM
Will this line work?

Alert("myAlert", NinjaTrader.Cbi.Priority.High, "Reached threshold", "Alert1.wav", 10, Color.Black, Color.Yellow);?



MoneyMate8, thank you for the question. Have you seen the PlaySound() method (http://www.ninjatrader-support.com/HelpGuideV6/helpguide.html?PlaySound)?

NinjaTrader_Austin
07-15-2009, 11:56 AM
Will this line work?

Alert("myAlert", NinjaTrader.Cbi.Priority.High, "Reached threshold", "Alert1.wav", 10, Color.Black, Color.Yellow);?

It sure looks like it will work. Why don't you try it out?

Greenmoney21
07-15-2009, 11:58 AM
Thanks.. i'll try it out if it works then its fantastic :) i got that line from this forum as well.. but your line looks very simple, will try both... :)

thank you for your support...


It sure looks like it will work. Why don't you try it out?