Go Back   NinjaTrader Support Forum > NinjaTrader 7 > Platform Technical Support

Platform Technical Support General platform technical support for NinjaTrader 7.

Reply
 
Thread Tools Display Modes
Old 10-20-2010, 10:17 AM   #1
Art09
Senior Member
 
Join Date: Apr 2009
Posts: 190
Thanks: 1
Thanked 0 times in 0 posts
Default CrossAbove/Below methods - help please...

Hi,
Please help. I tried to post this under programming but did not get any help. I'm not C# programmer. I'm trying to write simple logic for Stoch indicator to play sounds when it crosses from below to above 20 or from above to below 80 lines.
Long example:

If (CrossAbove(k, 20, 1)... then play alert. The problem is it plays the sound when k <= 20. I expect this to work differently - if %k equals or above 20, e.g. crosses the 20 line from below up then play sound... In perfect world I would like to play the sound only if %k is between 15 and 21, e.g. when %k>15 but %k<22 when long, and no sounds when %k < 15 or %k >22. But I do not know how to write this and having problems with simpler idea of playing sound only when %k crosses 20 from below up... Any ideas and help please? Maybe you have some examples? Ninja support does not open my eyes so to speak, not enough info... Is there any other way to make this work? Is there other method I can use to write this simple logic?
And another thing. I also try to put the marker on the chart at the same time when alert plays. But for some reason DrawArrowUp/Down stopped working. It worked then it stopped... Maybe there is some conflict in that logic I wrote...???
Thank you very much.
Art09 is offline  
Reply With Quote
Old 10-20-2010, 10:36 AM   #2
NinjaTrader_RyanM1
NinjaTrader Customer Service
 
NinjaTrader_RyanM1's Avatar
 
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,127
Thanks: 249
Thanked 434 times in 427 posts
Default

Hello Art09,

In the future, please don't create a new thread for the same topic.

If you are not a programmer, the strategy wizard is a good place to help you generate the conditions in a point and click interface. If you'd like NinjaTrader support to help with what you're doing, please click the View Code button and copy and paste your efforts into a post. Include a description of what you think it should be doing and what it's doing instead.

If you'd like professional coding help, please consider a 3rd party NinjaScript consultant who can be hired to develop your strategy according to your specifications.
http://www.ninjatrader.com/webnew/pa...injaScript.htm
NinjaTrader_RyanM1 is offline  
Reply With Quote
Old 10-20-2010, 10:58 AM   #3
Art09
Senior Member
 
Join Date: Apr 2009
Posts: 190
Thanks: 1
Thanked 0 times in 0 posts
Default

This is not help. The question was about the confusion of Cross methods and I do not see a big deal for any of you to answer this question instead of referring me to strategy and such. IT is simple question: why this does not work as expected? The 3-rd party consultants will not answer this question. What's the point of referring me to them? To get rid of? At least provide some examples for creating strategies for more then MA crossovers in help and support... I tried creating the strategy but one must select the Stoch on the right and on the left, which means the Stoch will cross another Stoch which is nonsense. Try it yourself and see. And all it will write the same CrossAbove/Below methods which simply does not work as expected and this was the question. And if I get help the first time I would not post it again.
Thanks.
Art09 is offline  
Reply With Quote
Old 10-20-2010, 11:14 AM   #4
NinjaTrader_RyanM1
NinjaTrader Customer Service
 
NinjaTrader_RyanM1's Avatar
 
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,127
Thanks: 249
Thanked 434 times in 427 posts
Default

Art,

You haven't given us much to work with.

Quote:
If (CrossAbove(k, 20, 1)...
Doesn't work because there's a capital I in the if statement. k is not defined anywhere else. I don't know what it is.

There are many examples you can refer to for crossing conditions and help constructing these types of statements in the condition builder.
http://www.ninjatrader.com/support/h...on_builder.htm

Not starting a new thread is for your benefit. When you create a new thread, then we start over and can't advantage of the dialog needed to work through this stuff.
NinjaTrader_RyanM1 is offline  
Reply With Quote
Old 10-20-2010, 11:41 AM   #5
Art09
Senior Member
 
Join Date: Apr 2009
Posts: 190
Thanks: 1
Thanked 0 times in 0 posts
Default

It works fine, but not how I'd expect it. The question was why CrossAbove() gives me signals when it crosses below as well as above the 20 line but not only when above 20 line as expected if I write
if CrossAbove(...20...)? The English is my second lang. and above means above to me, e.g. above 20... more then 20. Does this require more logic and using only CrossAbove/Below not good enough? This is what I was asking hoping for some examples if available...
The condition builder will use CrossAbove/Below methods for crossovers which work fine for simple crossovers such as one MA crossing another MA.
If you cannot help that's fine. But I cannot ask 3-rd party consultants about it for sure.
Thank you.
Art09 is offline  
Reply With Quote
Old 10-20-2010, 11:58 AM   #6
NinjaTrader_RyanM1
NinjaTrader Customer Service
 
NinjaTrader_RyanM1's Avatar
 
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,127
Thanks: 249
Thanked 434 times in 427 posts
Default

CrossAbove requires that the crossing value is first lower and then crosses above the crossed value. It compares two bars to identify this crossing condition.

If you're looking to evaluate more or less than, then you use > or < operators for this.

If you're looking for help with technical analysis concepts, please refer to a site such as www.investopedia.com

If you post code snippets that don't compile, our assumption is that you need syntax help. If you're looking for help with a particular block of code: Post simple and valid code snippets, let us know what you think the code should be doing, and what it's doing instead.
NinjaTrader_RyanM1 is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
CrossAbove() "CJS" Strategy Development 6 09-28-2010 10:41 AM
CrossAbove vs. > Argo1 Strategy Development 1 09-06-2009 01:15 PM
CrossAbove / CrossBelow Shansen Indicator Development 7 07-04-2009 01:19 PM
CrossAbove GreenTrade Strategy Development 1 02-26-2009 07:56 AM
What does CrossAbove/Below do? tradefaz General Development 1 08-23-2008 12:56 PM


All times are GMT -6. The time now is 02:13 AM.

Futures, foreign currency and options trading contains substantial risk and is not for every investor. An investor could potentially lose all or more than the initial investment. Risk capital is money that can be lost without jeopardizing ones financial security or lifestyle. Only risk capital should be used for trading and only those with sufficient risk capital should consider trading. Past performance is not necessarily indicative of future results. View Full Risk Disclosure.

CFTC Rules 4.41 - Hypothetical or Simulated performance results have certain limitations, unlike an actual performance record, simulated results do not represent actual trading. Also, since the trades have not been executed, the results may have under-or-over compensated for the impact, if any, of certain market factors, such as lack of liquidity. Simulated trading programs in general are also subject to the fact that they are designed with the benefit of hindsight. No representation is being made that any account will or is likely to achieve profit or losses similar to those shown.

This website is hosted and operated by NinjaTrader, LLC (“NT”), a software development company which owns and supports all proprietary technology relating to and including the NinjaTrader trading platform. NT is an affiliated company to NinjaTrader Brokerage (“NTB”), which is a NFA registered introducing broker (NFA #0339976) providing brokerage services to traders of futures and foreign exchange products. This website is intended for educational and informational purposes only and should not be viewed as a solicitation or recommendation of any product, service or trading strategy. No offer or solicitation to buy or sell securities, securities derivative or futures products of any kind, or any type of trading or investment advice, recommendation or strategy, is made, given, or in any manner endorsed by any NT affiliate and the information made available on this Web site is not an offer or solicitation of any kind. Specific questions related to a brokerage account should be sent to your broker directly. The content and opinions expressed on this website are those of the authors and do not necessarily reflect the official policy or position of NT or any of its affiliates. 

Vendors along with their websites, products and services, collectively referred to as (“Vendor Content”), are independent persons or companies that are in no manner affiliated with NT or any if its affiliates. NT or any of its affiliates are not responsible for, do not approve, recommend or endorse any Vendor Content referenced on this website and it’s your sole responsibility to evaluate Vendor Content. Please be aware that any performance information provided by a vendor should be considered hypothetical and must contain the disclosures required by NFA Rule 2-29(c). If you are interested in learning more about, or investigating the quality of, any such Vendor Content you must contact the vendor, provider or seller of such Vendor Content. No person employed by, or associated with, NT or any of its affiliates is authorized to provide any information about any such Vendor Content. Visit the CFTC resources for education regarding the industry and signs of fraud.