Can I use a \n character in an indicator Property ?? - NinjaTrader | futures io social day trading
futures io futures trading


Can I use a \n character in an indicator Property ??
Updated: Views / Replies:542 / 3
Created: by podski Attachments:0

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors – all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you don’t need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 
Thread Tools Search this Thread
 

Can I use a \n character in an indicator Property ??

  #1 (permalink)
The Narrow Road
Belgium
 
Futures Experience: Intermediate
Platform: Ninjatrader
Broker/Data: Ninjatrader Brokerage, CQG
Favorite Futures: FDAX, FDXM ...maybe
 
podski's Avatar
 
Posts: 379 since Sep 2012
Thanks: 443 given, 457 received

Can I use a \n character in an indicator Property ??

Can I have a "\n" character in a string variable that I set using Ninjatrader indicator properties?

Ex:
private string entryText = "Entry\nPrice";

DrawText(..., entryText,...);

+Properties
[GridCategory("Screen Text")]
[Gui.Design.DisplayName ("Entry Price")]
public string EntryText
{
get { return entryText; }
set { entryText = value; }
}

The issue is that if I have a "\n" character and I do not escape it with another \ then it does not appear in the properties. If I escape it then it prints as "Entry\nPrice";

Is there a way around this apart from offsetting with two DrawText statements?

regards

p

Reply With Quote
 
  #2 (permalink)
Elite Member
Northern Germany
 
Futures Experience: Intermediate
Platform: NT
Favorite Futures: FDAX, CL
 
vvhg's Avatar
 
Posts: 1,583 since Mar 2011
Thanks: 1,016 given, 2,807 received

Answer
This post has been selected as an answer to the original posters question Answer


podski View Post
Can I have a "\n" character in a string variable that I set using Ninjatrader indicator properties?

Ex:
private string entryText = "Entry\nPrice";

DrawText(..., entryText,...);

+Properties
[GridCategory("Screen Text")]
[Gui.Design.DisplayName ("Entry Price")]
public string EntryText
{
get { return entryText; }
set { entryText = value; }
}

The issue is that if I have a "\n" character and I do not escape it with another \ then it does not appear in the properties. If I escape it then it prints as "Entry\nPrice";

Is there a way around this apart from offsetting with two DrawText statements?

regards

p

Easiest would be to have two properties and then add the newline in code, then DrawText. Alternatively you could use some character as placeholder for the newline and substitute it for the newline in code.

Vvhg

Hic Rhodos, hic salta.
Reply With Quote
The following user says Thank You to vvhg for this post:
 
  #3 (permalink)
The Narrow Road
Belgium
 
Futures Experience: Intermediate
Platform: Ninjatrader
Broker/Data: Ninjatrader Brokerage, CQG
Favorite Futures: FDAX, FDXM ...maybe
 
podski's Avatar
 
Posts: 379 since Sep 2012
Thanks: 443 given, 457 received

use string.Replace()


found it .. thanks vvhg

use the string.Replace() function in the Properties section

[GridCategory("Screen Text")]
[Gui.Design.DisplayName ("Eject Tag")]
public string EjectTag
{
get {
// tmp is a temporary local variable
string tmp = ejectTag.Replace("\\n","\n");
ejectTag = tmp;
return ejectTag;
}
set { ejectTag = value; }
}

Reply With Quote
 
  #4 (permalink)
Elite Member
Portland Oregon, United States
 
Futures Experience: Beginner
Platform: Ninjatrader®
Broker/Data: CQG, Kinetick
Favorite Futures: Gameplay Klownbine® Trading of Globex
 
Zondor's Avatar
 
Posts: 1,327 since Jul 2009
Thanks: 1,246 given, 2,635 received

More information on string manipulation

Answer
This post has been selected as an answer to the original posters question Answer

This is all good to know and may be useful for other applications. In addition to the Replace method there is a more efficient Stringbuilder class.

C# Replace String Examples

"If we don't loosen up some money, this sucker is going down." -GW Bush, 2008
“Lack of proof that something is true does not prove that it is not true - when you want to believe.” -Humpty Dumpty, 2014
“The greatest shortcoming of the human race is our inability to understand the exponential function.”
Prof. Albert Bartlett
Reply With Quote
The following user says Thank You to Zondor for this post:

Reply



futures io > > > > Can I use a \n character in an indicator Property ??

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Linda Bradford Raschke: Reading The Tape

Elite only

Adam Grimes: TBA

Elite only

NinjaTrader: TBA

January

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Why China's Property Market Is Getting Scary Quick Summary News and Current Events 0 March 5th, 2013 06:10 AM
US Citizens & Their Property Collateral for US Debt Victory Trader News and Current Events 0 September 20th, 2012 03:02 PM
Interval Property in a scan moonshadow ThinkOrSwim 0 July 10th, 2012 08:29 PM
China Vows to Prevent Rebound in Property Prices Quick Summary News and Current Events 0 July 8th, 2012 10:30 AM
Fib retracement property in NT7? jz166 NinjaTrader Programming 4 June 26th, 2011 01:54 PM


All times are GMT -4. The time now is 09:23 AM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts
Page generated 2017-12-13 in 0.09 seconds with 27 queries on phoenix via your IP 54.82.56.95