Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Indicator Draw code within MarketAnalyzer
Collapse
X
-
Attached is CalcTakeProfit() submethod (function) placed below onbarupdate and before properties
if (MyInput0 == 1)
if (!Historical || CurrentBar >= Bars.Count -2)
{
myTempstring = "+ " + Math.Round((CalcTakeProfit(1,true) - Close[0])/(TickSize),0).ToString() +
" | " + Math.Round((CalcTakeProfit(1,false) - Close[0])/(TickSize),0).ToString();
DrawTextFixed("MyFixedStringTop", myTempstring, TextPosition.TopRight);
myTempstring = "- " + Math.Round( (Close[0] - CalcTakeProfit(2,true))/(TickSize),0).ToString() +
" || " + Math.Round((Close[0] - CalcTakeProfit(2,false))/(TickSize),0).ToString();
DrawTextFixed("MyFixedStringBottom", myTempstring, TextPosition.BottomRight);
}
Attached Files
Comment
-
the plot was a simple sma(200) - sma(50) that works fine in the market analyzer as long as i dont call the code i sent you (MyInput0 = 2). It all works fine in 6.5, If i am the first report of such behavior i would not be concerned Josh. Forum reply box only allows 1000 characters. Let me know and I can send you the code in NT7 and NT6.5. Whichever you like just tell me how?
Howie
Comment
-
Indicator reference to Bar Object in IF Condition Stmt
Thanks STR.
JOSH... I think its that the Market Analyzer is ignoring Bar Object references in the IF condition ... i.e.
if (!Historical || CurrentBar >= Bars.Count -2)
So what appears to be what I refered to as an NT 7 freeze up could have been NT 7 doing the long calcs on each and every bar. Hope this helps.
Howie
Comment
-
ohowie,
The issue is with in your code is with several of your while-loops:
You are running into infinite loops and this needs to be addressed in your code. You can test this very quickly by commenting out your logic in CalcTakeProfit and just return TakePrice = Close[0].Code:[COLOR=blue][FONT="]while [/FONT][/COLOR][FONT="]((CTPClose- TakePrice) < (15*TickSize))[/FONT]
Josh P.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
601 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
347 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
559 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
558 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment