Advise or guidance needed for an alternative to enum
Hi, I came across some code for an indicator in ninjatrader which uses enum values.
You can either select a buy indicator or a sell indicator but you can't have both on the same chart at the same time.
I would like to find an alternative to using enum or enhance enum functionality so that i can use both the buy and sell indicator at the same time. Essentially, the code for the buy and sell is the same except that the buy uses close<close and the sell uses close>close, the key being "<" and ">".
Without posting the code, there is really no helping you. Sorry.
For example, an alternative to enum could be an int. That isn't helpful.
Post the code.
Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.
Need help? 1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first. 2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses. 3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make. 4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance. 5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers. 6) Help using the forum? Watch this video to learn general tips on using the site.
If you want to support our community, become an Elite Member.
If you're going to show both buy and sell at the same time, this implies (according to your analysis) that close can be both < and > close at the same moment. Perhaps this is why it's disallowed. Good luck.
Btw, as other posters noted ... an enum is really a set of ints. It's just a notation device to make comparisons, etc easier and more meaningful for readers of the code.
You might try something like the following ...
const int Buy = 1, Sell = 2, BuyAndSell = 3;
Side = Sell;
switch ( Side )
// Do something
// Do Something else.
Print( "Illegal action.\n");
Last edited by kandlekid; February 4th, 2010 at 03:58 AM.
The following user says Thank You to kandlekid for this post:
I've attached the whole code. To be honest, if I could use an alternative to enum is probably the way to go though you need something to let it know that you are on a BUY count or SELL count. While they cannot happen (the BUY & SELL) together, displaying them on the chart at the same time is very useful as some trades can be identified that way...