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
Hma rising and falling arrows
Collapse
X
-
You are setting the value to the first level. You're not incrementing it at each condition. The lines highlighted below say, "Add/subtract 100 to the value of alert price up". It's equivalent to writing
alertPriceUp = alertPriceUp + 100
Code:if (CrossAbove(Close, alertPriceUp, 1)) { Alert("MyAlert1137", Priority.High, "", @"C:\Program Files\NinjaTrader 7\sounds\tick 1300.wav", 10, Color.White, Color.Black); DrawArrowUp("My up arrow" + CurrentBar, false, 0, Low[0] + -15 * TickSize, Color.Yellow); [COLOR=red][B]alertPriceUp += 100;[/B][/COLOR] Print(Time[0].ToString() + " " + Close[0] + " " + "some text here at the end"); } if (CrossBelow(Close, alertPriceDown, 1)) { Alert("MyAlert1137", Priority.High, "", @"C:\Program Files\NinjaTrader 7\sounds\tick -1300.wav", 10, Color.White, Color.Black); DrawArrowDown("My down arrow" + CurrentBar, false, 0, High[0] + 15 * TickSize, Color.Yellow); [B][COLOR=red]alertPriceDown -= 100;[/COLOR][/B] Print(Time[0].ToString() + " " + Close[0] + " " + "some text here at the end"); }
Ryan M.NinjaTrader Customer Service
Comment
-
Draw problems again
Hi Guys, still having problems with drawing things. I'm trying to insert the closing volume bar value at the top of each candle. I am able to draw text no problem but not sure how I go about getting the value of an indicator above or below the candle.
DrawText("My text" + CurrentBar, "150", 0, Low[0] - 8 * TickSize, Color.Lime);
Amy ideas on this one? Thanks. DJ
Comment
-
Great!
Thanks Bertrand, you know I spent forever trying to find how to do that, and you do it in 1 minute. Now I am trying to put it in the candle which I can do ok but when I try to put a background behind it says method requires 10 arguments. I checked against the drawtext() in the manual but the example doesn't have all the items in it. Any ideas on this one? Thanks. DJ
private Font textFontMed = new Font("Arial", 8, FontStyle.Bold);
DrawText("My text" + CurrentBar, (GomDeltaVolume().UpVolume[0] + GomDeltaVolume().DownVolume[0]).ToString(), 0, ((Open [0] + Close[0])/2), Color.Lime,textFontMed, StringAlignment.Center, Color.Black, Color.Pink, 5);
Comment
-
Drawtext
Hi Bertrand, still researching this problem. Have another baffling problem as well. I have a condition that once satisfied is supposed to draw the value at the low of the candle (Output1) and draw another value in the middle of the candle (Output 2). Problem is it will only draw one and not the other. If I remove draw text output 1 it will draw output 2. If I remove output 2 it will draw output 1 BUT will never draw both at the same time. I was wondering then if you can draw two things around a candle at the same time? Thanks.
Output 1
DrawText("My text" + CurrentBar, (((GomDeltaVolume().UpVolume[0] + GomDeltaVolume().DownVolume[0])*100)/Volume[0]).ToString("N0"), 0, Low[0] -2 * TickSize, Color.Yellow);
Output 2
DrawText("My text" + CurrentBar, (GomDeltaVolume().UpVolume[0] + GomDeltaVolume().DownVolume[0]).ToString(), 0, ((Open [0] + Close[0])/2), Color.Lime);
Comment
-
Hello djkiwi,
The issue is that you're using the same tag for both objects. Note unique tags below:
Code:DrawText([COLOR="red"]"My text"[/COLOR] + CurrentBar, (((GomDeltaVolume().UpVolume[0] + GomDeltaVolume().DownVolume[0])*100)/Volume[0]).ToString("N0"), 0, Low[0] -2 * TickSize, Color.Yellow); DrawText([COLOR="Red"]"My text2"[/COLOR] + CurrentBar, (GomDeltaVolume().UpVolume[0] + GomDeltaVolume().DownVolume[0]).ToString(), 0, ((Open [0] + Close[0])/2), Color.Lime);
Ryan M.NinjaTrader Customer Service
Comment
-
Drawtext
Thanks Bertrand, I really need to learn this stuff faster
Anyway the other issue is still causing a problem. I went back through it all and still doesn't work. I found this code from Josh on another post. I see I had missed out false on my version and have no inserted it. The problem is when I compile with the one from Josh and comment out mine (below) I get the same error with his one. No overload method draw text takes 11 arguments. I have checked it and has all of the items that is needed? Any other ideas on this one? Thanks. DJ
1. Josh
DrawText("test", false, "Test Text", 5, MAX(High, 20)[0], Color.Red, new Font("Arial", 12), StringAlignment.Far, Color.Transparent, Color.Transparent, 50);
2. Mine
//DrawText("My text8" + CurrentBar, false, (GomDeltaVolume().UpVolume[0] + GomDeltaVolume().DownVolume[0]).ToString(), 0, ((Open [0] + Close[0])/2), Color.Lime,textFontMed, StringAlignment.Center, Color.Black, Color.Pink, 5);
Comment
-
You can use intellisense to help generate the right syntax. Just type DrawText( and then cycle through the available overloads with your up and down arrows. Advance through each field with a comma ,
DrawText(string tag, bool autoScale, string text, int barsAgo, double y, int yPixelOffset, Color textColor, Font font, StringAlignment alignment, Color outlineColor, Color areaColor, int areaOpacity)Ryan M.NinjaTrader Customer Service
Comment
-
Arrow Outline Color
Just converted to NT7 and I notice that most indicator arrows seem to have a white outline around them that did not occur in NT6.5. I prefer a black outline. For candles, I can change the outline color using CandleOutlineColor. Is there a similar way to change the arrow outline color? If so, does this method apply to other drawing objects (triangles, dots, etc) as well?
Ok, with sufficient digging through posts, I found where it was explained that the arrow and other object outline colors are determined by the axis color. Explains the white halo, but still makes the objects look like crap when used with a dark background and a light color axis.
You really should consider changing this in a future revision.
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by algospoke, Yesterday, 06:40 PM
|
2 responses
23 views
0 likes
|
Last Post
by algospoke
Today, 07:04 PM
|
||
Started by ghoul, Today, 06:02 PM
|
3 responses
14 views
0 likes
|
Last Post Today, 06:43 PM | ||
Started by jeronymite, 04-12-2024, 04:26 PM
|
3 responses
45 views
0 likes
|
Last Post
by jeronymite
Yesterday, 10:10 PM
|
||
Started by Barry Milan, Yesterday, 10:35 PM
|
7 responses
22 views
0 likes
|
Last Post Today, 06:16 PM | ||
Started by AttiM, 02-14-2024, 05:20 PM
|
10 responses
181 views
0 likes
|
Last Post
by jeronymite
Today, 06:11 PM
|
Comment