NexusFi: Find Your Edge


Home Menu

 





Want to create an indicator and have no idea where to start?


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one forrestang with 58 posts (9 thanks)
    2. looks_two ThatManFromTexas with 16 posts (5 thanks)
    3. looks_3 LostTrader with 6 posts (2 thanks)
    4. looks_4 cory with 5 posts (3 thanks)
      Best Posters
    1. looks_one cory with 0.6 thanks per post
    2. looks_two ThatManFromTexas with 0.3 thanks per post
    3. looks_3 LostTrader with 0.3 thanks per post
    4. looks_4 forrestang with 0.2 thanks per post
    1. trending_up 26,163 views
    2. thumb_up 20 thanks given
    3. group 5 followers
    1. forum 93 posts
    2. attach_file 30 attachments




 
Search this Thread

Want to create an indicator and have no idea where to start?

  #41 (permalink)
 
forrestang's Avatar
 forrestang 
Chicago IL
 
Experience: None
Platform: Ninja, MT4, Matlab
Broker: CQG, AMP, MB, DTN
Trading: E/U, G/U
Posts: 1,329 since Jun 2010
Thanks Given: 354
Thanks Received: 1,047


forrestang View Post
The 7th variable is the color of the bars, I may have to actually create inside the original indicator?

Got it!

This one wasn't the same. So I created a int DataSeries in the original indicator.

Then I could access it. But initially, this only changes the Data series when the color changed. So it wasn't a populated data series for every bar... if that makes sense?

So my DataSeries was all zeros, and +1 when up, and -1 when down. The zeroes weren't any good in there, so I added an IF statement:

 
Code
if (ERG_Trade().Ltsx[0] == 0) 
{
ERG_Trade().Ltsx[0] = ERG_Trade().Ltsx[1];
}
"Ltsx" is my data series created in the original. So now, after getting the data series, I check for 0, and if it is equal to 0, then fill it in with the previous bar's color bar value.

And here is a pic, it is tracking the change of the color bars. So I've got all 7 variables I need, now on to phase II for real this time!

Attached Thumbnails
Click image for larger version

Name:	LTS_Color.jpg
Views:	217
Size:	99.1 KB
ID:	39613  
Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
MC PL editor upgrade
MultiCharts
ZombieSqueeze
Platforms and Indicators
Trade idea based off three indicators.
Traders Hideout
About a successful futures trader who didnt know anythin …
Psychology and Money Management
REcommedations for programming help
Sierra Chart
 
  #42 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,463 since Jun 2009
Thanks Given: 33,242
Thanks Received: 101,662

 
Thread Moved


Thread moved to NinjaTrader Programming



When creating a new thread, note which subforum you are in. Here is a short list of suggestions:

- Topic: Anything to do with an Elite indicator -> Subforum: The Elite Circle
- Topic: Looking for an existing indicator, or how-to use an indicator -> Subforum: (the platform)
- Topic: Programmer needing help with non-Elite indicator -> Subforum: (the platform) - Programming
- Topic: Want an indicator created/modified -> Reply to "Want indicator created free" in Elite Circle
- Topic: Vendors (trading rooms, commercial indicators) -> Subforum: Vendors/Product Reviews
- Topic: Discussion of Forex or Currency trading -> Subforum: Forex and Currency Trading
- Topic: Journals of your trading -> Subforum: Trading Journals or Elite Trading Journals
- Topic: General trading related discussions -> Subforum: Traders Hideout
- Topic: Discussion of a trading method -> Subforum: Traders Hideout
- Topic: Automated Trading -> Subforum: Elite Automated Trading

Last, any Elite Member may create more or less any of these topics in The Elite Circle at your own discretion (your support is appreciated).

This is just a short general list and doesn't cover everything. If you are unsure where to create your new thread, just create it in Traders Hideout and a moderator will move it if necessary.

-- Big Mike Trading



Mike



Join the free Markets Chat beta: one platform, all the trade rooms!

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
  #43 (permalink)
 
forrestang's Avatar
 forrestang 
Chicago IL
 
Experience: None
Platform: Ninja, MT4, Matlab
Broker: CQG, AMP, MB, DTN
Trading: E/U, G/U
Posts: 1,329 since Jun 2010
Thanks Given: 354
Thanks Received: 1,047



forrestang View Post
............now on to phase II for real this time!

Woot!!!

I'm adding these trade definitions in a really clumsy way at the moment, but they are there, which is exciting. Take a look at the pic, you see 3 green arrows where possible trades are. I have a ton more scenarios to add in manually, but it's on the right track for now.

Oh, Woot!!

Attached Thumbnails
Click image for larger version

Name:	Desktop.jpg
Views:	239
Size:	164.8 KB
ID:	39623  
Started this thread Reply With Quote
  #44 (permalink)
 
forrestang's Avatar
 forrestang 
Chicago IL
 
Experience: None
Platform: Ninja, MT4, Matlab
Broker: CQG, AMP, MB, DTN
Trading: E/U, G/U
Posts: 1,329 since Jun 2010
Thanks Given: 354
Thanks Received: 1,047


zeller4 View Post
Hi Forrestang,

If your ProfTest Code still had this:

.........you ought to add this [CODE*TickSize][/CODE] so it will look like this:


..........as dataseries so that you can reference the prior bar's state. There are ways to use loops to emulate a dataseries (which is over my head). Otherwise, need to find otherways to draw arrows for only when the condition changes (if that's what you prefer to see rather than several continuous bars with the arrow below.

Keep up the good work.

Kirk

Made your adjustment on the arrows, thanks!

I've got a clumsy way to draw the arrows only on the bar when it switches.

Started this thread Reply With Quote
  #45 (permalink)
 
forrestang's Avatar
 forrestang 
Chicago IL
 
Experience: None
Platform: Ninja, MT4, Matlab
Broker: CQG, AMP, MB, DTN
Trading: E/U, G/U
Posts: 1,329 since Jun 2010
Thanks Given: 354
Thanks Received: 1,047

Having a problem.

Here is a pic of my indicator, and the code associated with my clumsy way of painting arrows. I have a lot of specific scenarios I want to set up, so I want to paint the scenario(1a_a, 1a_b, 1a_c... etc) along with the chart marker.

Here, all 3 of these green arrows on my chart should have the label "1a_a" under their prices like the one arrow does. I dont know how to use the "Draw" feature obviously.

How should this be set so the text will be drawn just like each arrow?

Here is the code snippet if it's hard to see:
 
Code
if(ERG_Trade().Ltsx[0] == 1 && ERG_Str1().HISTSlope[0] == 1 && ERG_Trade().HIST[0] >= 10 )
	{
	   if(ERG_Trade().HISTSlope[1] == 1 && ERG_Trade().HISTSlope[2] == 1 && ERG_Trade().HISTSlope[3] == -1)
		{	
		DrawArrowUp("arrow"+CurrentBar.ToString(), true, Time[0], Low[0]-12*TickSize, Color.Green);
		DrawText("text"+CurrentBar.ToString(), Open.ToString(), 0, Low[0]-30*TickSize, Color.Black);
		DrawText("text","1a_a", 0, Low[0]-38*TickSize, Color.Black);
		}
	}
Initially i thought it was because those DrawText objects with the same tag. But I checked by removing one of them, and still the same problem. So still not sure why it won't draw on ALL the arrows?

Attached Thumbnails
Click image for larger version

Name:	Prime2011-05-30_184623.jpg
Views:	222
Size:	324.3 KB
ID:	39627  
Started this thread Reply With Quote
  #46 (permalink)
 
cory's Avatar
 cory 
virginia
 
Experience: Intermediate
Platform: ninja
Trading: NQ
Posts: 6,098 since Jun 2009
Thanks Given: 877
Thanks Received: 8,090

you are giving them identical tag 'text' in this case, try text1, text2, text3 instead.

Reply With Quote
  #47 (permalink)
 
forrestang's Avatar
 forrestang 
Chicago IL
 
Experience: None
Platform: Ninja, MT4, Matlab
Broker: CQG, AMP, MB, DTN
Trading: E/U, G/U
Posts: 1,329 since Jun 2010
Thanks Given: 354
Thanks Received: 1,047


cory View Post
you are giving them identical tag 'text' in this case, try text1, text2, text3 instead.

I tried that, still seems to not print.

Started this thread Reply With Quote
  #48 (permalink)
 
ThatManFromTexas's Avatar
 ThatManFromTexas 
Houston,Tx
 
Experience: Advanced
Platform: NinjaTrader
Broker: Mirus Futures/Zen-Fire
Trading: TF
Posts: 2,265 since Feb 2010
Thanks Given: 1,206
Thanks Received: 4,355


forrestang View Post
Having a problem.

Here is a pic of my indicator, and the code associated with my clumsy way of painting arrows. I have a lot of specific scenarios I want to set up, so I want to paint the scenario(1a_a, 1a_b, 1a_c... etc) along with the chart marker.

Here, all 3 of these green arrows on my chart should have the label "1a_a" under their prices like the one arrow does. I dont know how to use the "Draw" feature obviously.

How should this be set so the text will be drawn just like each arrow?

Here is the code snippet if it's hard to see:
 
Code
if(ERG_Trade().Ltsx[0] == 1 && ERG_Str1().HISTSlope[0] == 1 && ERG_Trade().HIST[0] >= 10 )
	{
	   if(ERG_Trade().HISTSlope[1] == 1 && ERG_Trade().HISTSlope[2] == 1 && ERG_Trade().HISTSlope[3] == -1)
		{	
		DrawArrowUp("arrow"+CurrentBar.ToString(), true, Time[0], Low[0]-12*TickSize, Color.Green);
		DrawText("text"+CurrentBar.ToString(), Open.ToString(), 0, Low[0]-30*TickSize, Color.Black);
		DrawText("text","1a_a", 0, Low[0]-38*TickSize, Color.Black);
		}
	}
Initially i thought it was because those DrawText objects with the same tag. But I checked by removing one of them, and still the same problem. So still not sure why it won't draw on ALL the arrows?

Try this


 
Code
 
                DrawArrowUp("arrow"+CurrentBar, true, 0, Low[0]-12*TickSize, Color.Green);
		DrawText("text0"+CurrentBar, ""+Open.ToString(), 0, Low[0]-30*TickSize, Color.Black);
		DrawText("text1"+CurrentBar ,"1a_a", 0, Low[0]-38*TickSize, Color.Black);

I'm just a simple man trading a simple plan.

My daddy always said, "Every day above ground is a good day!"
Reply With Quote
Thanked by:
  #49 (permalink)
 
forrestang's Avatar
 forrestang 
Chicago IL
 
Experience: None
Platform: Ninja, MT4, Matlab
Broker: CQG, AMP, MB, DTN
Trading: E/U, G/U
Posts: 1,329 since Jun 2010
Thanks Given: 354
Thanks Received: 1,047


ThatManFromTexas View Post
Try this......

Yep! Thanks, that did it!

Attached Thumbnails
Click image for larger version

Name:	Prime2011-05-31_010504.jpg
Views:	218
Size:	53.2 KB
ID:	39644  
Started this thread Reply With Quote
  #50 (permalink)
 
forrestang's Avatar
 forrestang 
Chicago IL
 
Experience: None
Platform: Ninja, MT4, Matlab
Broker: CQG, AMP, MB, DTN
Trading: E/U, G/U
Posts: 1,329 since Jun 2010
Thanks Given: 354
Thanks Received: 1,047


Got the logic done and it's doing what I want.

Is there a simple way to add a closing arrow to this? Does NT have some function built in so that once my green/red arrow prints to show my entry, I can plot an exit AFTER that entry arrow?

Asking as eventually I'll want to kick this out to a strategy.

Attached Thumbnails
Click image for larger version

Name:	Prime2011-06-01_020747.jpg
Views:	257
Size:	168.6 KB
ID:	39730  
Started this thread Reply With Quote




Last Updated on January 20, 2012


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts