Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
MA Cross Alert in Market Analyzer
Collapse
X
-
MA Cross Alert in Market Analyzer
Is it possible to create an alert in Market Analyzer when 2 MA's cross? -
Hi rcmcd,
This is possible to do but would require a simple custom coded indicator.
The indicator would need to detect the cross and then plot 1 when the crossabove is detected, -1 when a crossbelow is detected, and 0 when there is no cross.
In the Market Analyzer, you would add this as an indicator column. Then you can use alert, cell, and filter conditions on this.
If you are interested in creating this indicator, below are a few resources to help you get started.
The best way to begin learning NinjaScript is to use the Strategy Wizard. With the Strategy Wizard you can setup conditions and variables and then see the generated code in the NinjaScript Editor by clicking the View Code button.
I'm also proving a link to a recently recorded 'Automated Strategy Development Webinar' video for you to view at your own convenience: Automated Strategy Development Level 1 - NinjaTrader Training - 3/26/2013
We also have great resources in relation to Strategy Development on our Support Forum. There is a very active developer community in our support forum that supplements the responses provided by NinjaTrader support staff providing all users with an exceptional support experience.
Take me to your support forum!
There are a few Sample Automated Strategies which come pre-configured in NinjaTrader that you can use as a starting point. These are found under Tools--> Edit NinjaScript--> Strategy. You will see locked strategies where you can see the details of the code, but you will not be able to edit (you can though always create copies you can later edit via right click > Save as)
We also have some Reference samples online as well as ‘Tips and Tricks’ for both indicators and strategies:
Click here to see our NinjaScript Reference Samples
Click here to see our NinjaScript Tips
These samples can be downloaded, installed and modified from NinjaTrader and hopefully serve as a good base for your custom works.
Further, the following link is to our help guide with an alphabetical reference list to all supported methods, properties, and objects that are used in NinjaScript.
Alphabetical Reference
We also have a few tutorials in our help guide for both Indicators and Strategies.
Indicator tutorials
Strategy tutorials
Last, if you would like to have this strategy coded for you, you may contact one of our professional NinjaScript consultants.
Click here to see our Consultants pageChelsea B.NinjaTrader Customer Service
-
Originally posted by rcmcd View PostIs it possible to create an alert in Market Analyzer when 2 MA's cross?Originally posted by NinjaTrader_ChelseaB View PostLast, if you would like to have this strategy coded for you, you may contact one of our professional NinjaScript consultants.
Click here to see our Consultants page
As Chelsea mentioned this is definitely possible and she has given an excellent set of resources for anyone wanting to code this themselves. You must have a plot created that can then be referenced in the Market Analyzer as Chelsea described.
With regards to her last point, if anyone is not wanting to code this themselves and instead looking for an existing solution, we are a proud NinjaTrader partner and have our Ultimate Moving Average Cross alert indicator bundle available. It includes an indicator for use on charts and also an additional indicator specifically written for use in the Market Analyzer and Strategies.
If anyone is interested, further information can be found at www.globaltradingtools.com/software/ultimate-moving-average-cross-alert-indicator-ninjatrader/
Thanks very much for your time!
Cheers
Stuart
Comment
-
Question along the same lines as alerts for Market Analyzer. Is there a way to set up a column that will give the results of say 4 or more other columns in the Market Analyzer. The one column set up will be able to alert when the other 4 columns are all the same for instance.
Thanks,
PanamaJack
Comment
-
Hi PanamaJack,
This is also possible to do, however, you will start needing to check things in OnFundamentalData().
A lot of the columns in the Market Analyzer are using fundamental data that comes directly from the provider.
Below is a link to the help guide on OnFundamentalData().
http://www.ninjatrader.com/support/h...mentaldata.htm
The method for having this work in the Market Analyzer is the same. You would set the plot to 0 when all 4 values are not matching and then 1 when all 4 values are matching. The difference would be the conditions you are checking in the script.Chelsea B.NinjaTrader Customer Service
Comment
-
i'm really struggling with this "plot0" functionality.
perhaps someone can point me into the right direction?
according to the idea in this thread i'd like to do the following:
if close [0] > SMA (50) [0] -> result (in indicator window) should be "+1"
if close [0] >= SMA (25) [0] && < SMA (50) [0] -> result should be "0"
if close [0] < SMA (25) [0] -> result should be "-1"
the first errors appear after trying to overwork the condition:
"Plot0.Set"
thanks!!
Comment
-
Hello,
Thank you for the question.
The syntax should be Plot0.Set(-1); 1 or 0 as an example, can you tell me what specific error you are getting or could you provide the specific syntax causing the problem?
If you do not have a property defined for Plot0 this may be the case, you can also try using Value.Set(1);
I look forward to being of further assistance.JesseNinjaTrader Customer Service
Comment
-
Hi Jesse,
thanks for your asssitance,
attached my indicator (better: my trial to learn .....).
using your suggestion means:
- a lot of errors are deleted now
- but the indicator is only drawing "-1"
- and i had to comment out the middle condition because of an error
may i ask you to have a look at it?
thanks a lotAttached Files
Comment
-
Hello,
It looks like this could be due to the syntax/structure you are using. C# is very stucture orientied so the following syntax is not doing what you would expect it to:
Code:Plot0.Set(1); if (Close[0] > SMA (50)[0]); //Plot0.Set (0); //if (Close [0] >= SMA (25)[0]) "&&" (Close [0] < SMA (50)[0]); Plot0.Set(-1); if (Close[0] < SMA (50)[0]);
Instead you could try the following syntax which should produce a result more in line with what you are looking for:
Code:Plot0.Set(0); if (Close[0] > SMA (50)[0]) { Plot0.Set(1); } else if (Close[0] < SMA (50)[0]) { Plot0.Set(-1); }
This is important to set a default specifically for Market Analyzer indicators because otherwise the Close price is used if no condition sets the plot.
If statements do not ever need terminated with a semicolon if(something);
Instead using the method body as shown above would execute the code inside the { } if the condition is true.
Also the statement:
if (Close [0] >= SMA (25)[0]) "&&" (Close [0] < SMA (50)[0]);
could be formed as:
Code:if (Close [0] >= SMA (25)[0] && Close [0] < SMA (50)[0]) { }
JesseNinjaTrader Customer Service
Comment
-
Hi Jesse,
on the first view (and after changing the second condition from 50 to 25) it looks like it's working fine.
So, thank you very much so far!
On the second view: the condition is only working with "50" correct concerning the sma 50.
this is a kind of price against sma.
how can i add the middle condition, if price is between the two sma's?
using your suggestion gives wrong output
any ideas?
thanks youLast edited by Tradexxx; 12-11-2015, 01:32 PM.
Comment
-
Hello,
What you are trying is certainly possible using NinjaScript or to make a indicator specific for the MA, can you provide the current modified code so I can see what you are trying that is not working?
The logic and conditions in the indicator would need to make logical sense in order to work correctly with the MA, additionally if a value is not set the close price is used instead so there can be some extra items to pay attention to specifically for the MA indicators. With the code you are currently using it may be more apparent what is happening.
I look forward to being of further assistance.JesseNinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by bortz, 11-06-2023, 08:04 AM
|
47 responses
1,607 views
0 likes
|
Last Post
by aligator
Today, 07:22 PM
|
||
Started by jaybedreamin, Today, 05:56 PM
|
0 responses
9 views
0 likes
|
Last Post
by jaybedreamin
Today, 05:56 PM
|
||
Started by DJ888, 04-16-2024, 06:09 PM
|
6 responses
19 views
0 likes
|
Last Post
by DJ888
Today, 05:12 PM
|
||
Started by Jon17, Today, 04:33 PM
|
0 responses
6 views
0 likes
|
Last Post
by Jon17
Today, 04:33 PM
|
||
Started by Javierw.ok, Today, 04:12 PM
|
0 responses
16 views
0 likes
|
Last Post
by Javierw.ok
Today, 04:12 PM
|
Comment