Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Market Analyzer displays Close Price and Not Indicator Plot
Collapse
X
-
Hello mefTrader,
Thank you for your post.
Your issue in the Market Analyzer is this line:
if (CurrentBar < 200) return;
The Market Analyzer only has a lookback of 50 bars by default. You'll need to increase this for your column to at least 200, since your SMA requires that many bars of lookback to calculate. To do so, right click > Columns > select your indicator column and change the "# of bars to look back" setting to over 200, then click OK. You should then see the correct value in the Analyzer.
Please let us know if we may be of further assistance to you.
- Likes 1
Leave a comment:
-
Market Analyzer displays Close Price and Not Indicator Plot
My Indicator that I added to the Market Analyzer is displaying Closing price of the Instrument(see attachment) - dont know why Price is in the indicator part - it is not Plotting "TPS" ??
The Indicator works in the Chart but not the Market Analyzer - am I missing something in my code specific for the market analyzer ?
#region Variables
// Wizard generated variables
private int overSoldLong = 25; // Default setting for OverSoldLong
private int overBoughtLong = 70; // Default setting for OverBoughtLong
private int sellShort = 75; // Default setting for SellShort
private int coverShort = 30; // Default setting for CoverShort
private int biasLong = 0;
// User defined variables (add any user defined variables below)
#endregion
protected override void Initialize()
{
Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "TPS"));
Overlay = false;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// Use this method for calculating your indicator values. Assign a value to each
// plot below by replacing 'Close[0]' with your own formula.
// Do not calculate if we don't have enough bars
if (CurrentBar < 200) return;
double value_SMA = SMA(Close, 200)[0];
double curr_value_RSI = RSI(Close, 2, 0)[0];
double prev_value_RSI = RSI(Close, 2, 0)[1];
if ((curr_value_RSI> overBoughtLong ) | (Close[0] < value_SMA) )
{
biasLong = 0;
}
if (biasLong>0 & Close[0] < Close[1] & Close[0] > value_SMA)
{
biasLong = biasLong + 1;
}
else if ((curr_value_RSI < overSoldLong) & (prev_value_RSI < overSoldLong) & (Close[0] > value_SMA) )
{
biasLong = 1;
DrawLine("tag1", false, 1, prev_value_RSI, 0, curr_value_RSI, Color.LimeGreen, DashStyle.Dot, 2);
}
;
TPS.Set(biasLong);
}
1 Photo
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by judysamnt7, 03-13-2023, 09:11 AM
|
4 responses
57 views
0 likes
|
Last Post
by DynamicTest
Today, 08:25 PM
|
||
Started by ScottWalsh, Today, 06:52 PM
|
4 responses
36 views
0 likes
|
Last Post
by ScottWalsh
Today, 07:40 PM
|
||
Started by olisav57, Today, 07:39 PM
|
0 responses
7 views
0 likes
|
Last Post
by olisav57
Today, 07:39 PM
|
||
Started by trilliantrader, Today, 03:01 PM
|
2 responses
19 views
0 likes
|
Last Post
by helpwanted
Today, 07:25 PM
|
||
Started by cre8able, Today, 07:24 PM
|
0 responses
9 views
0 likes
|
Last Post
by cre8able
Today, 07:24 PM
|
Leave a comment: