PDA

View Full Version : Searching for the low on an indicator from entry


bigfatdrunk
06-15-2010, 05:21 PM
Hi all,

I know this is a somewhat newb question, but I'm stumped.

I'd like to find the low value of an indicator, not closes. I've checked out the SampleGetHighLowByTimeRange, and it's close to what I would like to do. However, where I'm stumped is applying this to an indicator, for example, the Diff on MACD. If I wanted to see where the lowest Diff is while I'm in the position, how can I do this?

Thanks!

NinjaTrader_Bertrand
06-16-2010, 04:07 AM
bigfatdrunk, you could look into the MIN and MAX methods for example, those would take dataseries as inputs as well, so you could apply them to indicator like the MACD and Diff.

http://www.ninjatrader-support.com/HelpGuideV6/MinimumMIN.html

bigfatdrunk
06-16-2010, 08:56 AM
Perfect. Thank you, Bertrand, it's working like a charm.

With a h/t to others who have done it, posting the code:

MIN((MACD(12,26,9).Diff, bse)[0]);

bse = BarsSinceEntry

And, for the record: yes, untrained chimpanzees CAN write better code than me. Thanks for asking.

NinjaTrader_Bertrand
06-16-2010, 08:59 AM
You're welcome great to hear it's working well - thanks for sharing your solution here.

BrianL
11-02-2010, 12:47 PM
Hello, I'm having some issues in getting the correct syntax for the Lowest Low Value/Highest High Value for a Momentum indicator. I'm used to writing code in JavaScript and going from that to C# is a pain to try and reconfigure indicators.

In JavaScript I would use the following line of code:

LLV(10, MOM(20)) = this would give me the lowest low value for the past 10 bars of a 20period momentum indicator. pretty simple.

What I don't understand is how to lay out the syntax correctly using MIN and MAX methods when getting those MIN or MAX values from an indicator in C#. The references are not very helpful in this respect.

I think the following is correct but I can't trust it until I know for sure.

I'm trying to say: "the lowest low value of the 20 period momentum indicator for the last 60 bars.

MIN(Momentum(20)[60]);

or

MIN(Momentum(20,60)[0]);

or

MIN((Momentum(20), 60)[0]);


Which one is it?

Thanks

NinjaTrader_RyanM
11-02-2010, 03:09 PM
Hello BrianL,

This is expressed as:
MIN((Momentum(20), 60)[0]);

A good way to identify syntax for nested indicators is with our Strategy Wizard. You can create in a point and click interface and then view the code.
http://www.ninjatrader.com/support/helpGuides/nt7/condition_builder.htm

BrianL
11-02-2010, 03:23 PM
Hello BrianL,

This is expressed as:
MIN((Momentum(20), 60)[0]);


thank you i figured it out