Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
DrawTextFixed(TextPosition.TopRight) not working
Collapse
X
-
yes. I even tried using the wizard to do the drawings (and compiling it) (with the adjusted y) and nothing comes out.
-
-
Hey, I believe the folder you sent is empty...
However, I noticed its called "indicator" - can you please tell me - is it possible to draw on the chart from a strategy - not from an indicator?
Comment
-
Thanks. Windows said the folder was empty, strange.
Anyhow, I was able to use the indicator successfully, however when trying to add the Add(new Plot... in initialize section, i get the following error:
Argument '1': cannot convert from 'NinjaTrader.Gui.Chart.Plot' to 'NinjaTrader.Indicator.IndicatorBase' CS1503 - click for info 64 8
its the same error I got before when trying to draw
Thx!
Comment
-
#region Using declarations
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml.Serialization;
using NinjaTrader.Cbi;
using NinjaTrader.Data;
using NinjaTrader.Indicator;
using NinjaTrader.Gui.Chart;
using NinjaTrader.Strategy;
#endregion
namespace NinjaTrader.Strategy
{
public class Diamonds : Strategy
{
#region Variables
private int myInput0 = 1; // Default setting for MyInput0
private string stock1 = "QQQQ";
private string stock2 = "DJI";
#endregion
protected override void Initialize()
{
Add(PeriodType.Tick, 1);
Add(stock1, PeriodType.Second, 2);
Add(stock2, PeriodType.Second, 2);
CalculateOnBarClose = false;
Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "Plot0"));
}
protected override void OnBarUpdate()
{
if (Closes[1][0] < Closes[1][1])
{
EnterLong();
MaxTime = 1;
DrawDiamond("my diamond" + CurrentBar, false, 0, Low[0] * TickSize, Color.Red);
}
if (BarsInProgress == 0 && Positions[1].MarketPosition == MarketPosition.Long)
{
if (MaxTime < 2)
{
ExitLong();
DrawDiamond("my diamond" + CurrentBar, false, 0, Low[0] * TickSize, Color.Red);
}
}
}
}
}Last edited by nightriderx; 07-21-2010, 04:05 PM.
Comment
-
nightriderx, if there are no errors in the logs, your diamonds are being drawn, but at the wrong price. Right now you have the y coordinate of the diamonds set to Low[0] * TickSize, which would most definitely be off of the chart for most instruments. On ES, for example, lets take a low of 1050 and multiply it by the tick size of 0.25. 1050 * 0.25 = 262.5, which is where your diamond would be drawn if this strategy is running on ES. YM would be one instrument where this should draw correctly because the tick size is 1.
Please change the y coordinates to something like Low[0] - 2 * TickSize. In addition, it could be that the conditions for your dot to be drawn aren't being met. It looks like you are using two second QQQQ bars for the entry signal. You may want to try extending that time a bit just to get a feel for how drawing objects work.AustinNinjaTrader Customer Service
Comment
-
thank you for your help. However, I have tried every thinkable instance of y, including actual price values (which are visible), changing from tick to seconds/minutes and even taking it out of the if statements to print at every bar and tried every other bar...however have seen no results. Can you please be so kind to point me to where I can find a sample Strategy (not indicator) which draws something - to use as a reference?
thx
Comment
-
Hi again, just to double check, are you re-compiling your scripts after making changes and then reloading the script on the chart? Or if you are running your strategy in the strategy tab, reloading it from there?
I have created a strategy that draws dots, just for you. Please take a look at the attachments.AustinNinjaTrader Customer Service
Comment
-
ok, I apologize, I did not realize that you have to manually load the strategies in the chart for the drawings to appear (assumed it does that automatically as it does for buy/sell signs)
once loaded - all works great! thank you very much for your help!!
just one last thing, can you please point me to where I can learn exactly how/why you must multiply Y by TickSize?
Comment
-
The only reason I include TickSize in the y calculations is to offset the drawing from the price bars by a little bit. You could use Low[0] or High[0] without any TickSize adjustment, but the draw objects would be right against the bars, and that could make the chart look a bit cluttered.AustinNinjaTrader Customer Service
Comment
-
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
599 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
344 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
103 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
558 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
557 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment