NexusFi: Find Your Edge


Home Menu

 





I need help with an indicator


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one mk77ch with 9 posts (1 thanks)
    2. looks_two cory with 3 posts (0 thanks)
    3. looks_3 ness1g with 2 posts (0 thanks)
    4. looks_4 Tasker_182 with 2 posts (0 thanks)
      Best Posters
    1. looks_one Fat Tails with 3 thanks per post
    2. looks_two Thxo with 1 thanks per post
    3. looks_3 Zondor with 1 thanks per post
    4. looks_4 mk77ch with 0.1 thanks per post
    1. trending_up 7,469 views
    2. thumb_up 9 thanks given
    3. group 10 followers
    1. forum 23 posts
    2. attach_file 6 attachments




 
Search this Thread

I need help with an indicator

  #1 (permalink)
 
mk77ch's Avatar
 mk77ch 
Switzerland
 
Experience: Advanced
Platform: NinjaTrader
Broker: Dorman
Trading: Currency Futures, ES
Posts: 130 since Oct 2010
Thanks Given: 27
Thanks Received: 347

hi guys,

i ported an indicator from mt4 to nt7 and it does actually work.
but the code is very ineffective because it recalculates all the bars each time OnBarUpdate is called.

does anybody have a good idea how to fix this?

thank you,
mike

Attached Files
Elite Membership required to download: mkGoldBands.zip
Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Exit Strategy
NinjaTrader
Are there any eval firms that allow you to sink to your …
Traders Hideout
ZombieSqueeze
Platforms and Indicators
Better Renko Gaps
The Elite Circle
New Micros: Ultra 10-Year & Ultra T-Bond -- Live Now
Treasury Notes and Bonds
 
  #3 (permalink)
 
trs3042's Avatar
 trs3042 
Holland, Michigan
 
Experience: None
Platform: ninjatrader
Broker: CQG
Trading: Acoustic Guitar
Posts: 1,617 since Jun 2009
Thanks Given: 23,764
Thanks Received: 5,616



mk77ch View Post
hi guys,

i ported an indicator from mt4 to nt7 and it does actually work.
but the code is very ineffective because it recalculates all the bars each time OnBarUpdate is called.

does anybody have a good idea how to fix this?

thank you,
mike

If you get no response here.....................try posting here:

Hope this helps,

Rick

"If you're going to panic during a trade............. panic early."
Reply With Quote
  #4 (permalink)
 
Tasker_182's Avatar
 Tasker_182 
Cedar Rapids, iowa
Legendary Market Wizard
 
Experience: Intermediate
Platform: Ninjatrader
Broker: Ninjatrader - Continuum
Posts: 716 since Aug 2009
Thanks Given: 476
Thanks Received: 1,401


mk77ch View Post
hi guys,

i ported an indicator from mt4 to nt7 and it does actually work.
but the code is very ineffective because it recalculates all the bars each time OnBarUpdate is called.

does anybody have a good idea how to fix this?

thank you,
mike

Is there a particular reason you are using a custom plot method verses DrawRegion?

Be yourself; everyone else is already taken. Oscar Wilde
Reply With Quote
  #5 (permalink)
 
mk77ch's Avatar
 mk77ch 
Switzerland
 
Experience: Advanced
Platform: NinjaTrader
Broker: Dorman
Trading: Currency Futures, ES
Posts: 130 since Oct 2010
Thanks Given: 27
Thanks Received: 347


Tasker_182 View Post
Is there a particular reason you are using a custom plot method verses DrawRegion?

yes, as far as i know its not possible using DrawRegion to have a semi transparent area like i want it in the indicator.
but the plot method isnt a problem at all and doesnt need to be edited.

the problem is located around line 74:

int01 = CurrentBar-1;

and below from:

while(int01 >= 0)

Started this thread Reply With Quote
  #6 (permalink)
 
Tasker_182's Avatar
 Tasker_182 
Cedar Rapids, iowa
Legendary Market Wizard
 
Experience: Intermediate
Platform: Ninjatrader
Broker: Ninjatrader - Continuum
Posts: 716 since Aug 2009
Thanks Given: 476
Thanks Received: 1,401


mk77ch View Post
yes, as far as i know its not possible using DrawRegion to have a semi transparent area like i want it in the indicator.
but the plot method isnt a problem at all and doesnt need to be edited.

the problem is located around line 74:

int01 = CurrentBar-1;

and below from:

while(int01 >= 0)

Okay, I understand but to close the loop on draw region, from the ninja help file.

Definition
Draws a region on a chart.

Method Return Value

An IRegion object that represents the draw object.


Syntax

DrawRegion(string tag, int startBarsAgo, int endBarsAgo, IDataSeries series, double y, Color outlineColor, Color areaColor, int areaOpacity)
DrawRegion(string tag, int startBarsAgo, int endBarsAgo, IDataSeries series1, IDataSeries series2, Color outlineColor, Color areaColor, int areaOpacity)

DrawRegion(string tag, DateTime startTime, DateTime endTime, IDataSeries series, double y, Color outlineColor, Color areaColor, int areaOpacity)

DrawRegion(string tag, DateTime startTime, DateTime endTime, IDataSeries series1, IDataSeries series2, Color outlineColor, Color areaColor, int areaOpacity)


Parameters

tag
A user defined unique id used to reference the draw object. For example, if you pass in a value of "myTag", each time this tag is used, the same draw object is modified. If unique tags are used each time, a new draw object will be created each time.

startBarsAgo
The starting bar (x axis co-ordinate) where the draw object will be drawn. For example, a value of 10 would paint the draw object 10 bars back.

startTime
The starting time where the draw object will be drawn.

endBarsAgo
The end bar (x axis co-ordinate) where the draw object will terminate

endTime
The end time where the draw object will terminate

series, series1, series2
Any DataSeries type object such as an indicator, Close, High, Low etc.. The value of the object will represent a y value.

y
Any double value

outlineColor
Region outline color (reference)

areaColor
Region fill color (reference)

areaOpacity
Sets the level of transparency for the fill color. Valid values between 0 - 10. (0 = completely transparent, 10 = no opacity)


Examples

// Fills in the region between the upper and lower bollinger bands
DrawRegion("tag1", CurrentBar, 0, Bollinger(2, 14).Upper, Bollinger(2, 14).Lower, Color.Empty, Color.Lime, 2);

Be yourself; everyone else is already taken. Oscar Wilde
Reply With Quote
  #7 (permalink)
 
mk77ch's Avatar
 mk77ch 
Switzerland
 
Experience: Advanced
Platform: NinjaTrader
Broker: Dorman
Trading: Currency Futures, ES
Posts: 130 since Oct 2010
Thanks Given: 27
Thanks Received: 347

yes you are right, i changed the code
but the main problem still remains unsolved...
in case this helps with motivation i am willing to pay for the fix of the code

Attached Files
Elite Membership required to download: mkGoldBands.zip
Started this thread Reply With Quote
  #8 (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


mk77ch View Post
yes you are right, i changed the code
but the main problem still remains unsolved...
in case this helps with motivation i am willing to pay for the fix of the code

running below 20% CPU usage with your indicator, 8G of memory, maybe you need more memory?

Reply With Quote
  #9 (permalink)
 
mk77ch's Avatar
 mk77ch 
Switzerland
 
Experience: Advanced
Platform: NinjaTrader
Broker: Dorman
Trading: Currency Futures, ES
Posts: 130 since Oct 2010
Thanks Given: 27
Thanks Received: 347


cory View Post
running below 20% CPU usage with your indicator, 8G of memory, maybe you need more memory?

i have 16gb of ram thats not the problem.
i am using the indicator to trade gold on a relative small better renko chart and due to intense calculations during fast moving market ninjatrader hangs/freezes for a few seconds. so its not possible to set orders during these times.

i use it with cobc=false and each tick the indicator is calculated over all x thousand bars.
i really need this to be fixed...

Started this thread Reply With Quote
  #10 (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,397 since Jun 2009
Thanks Given: 33,173
Thanks Received: 101,537


@Zondor likes a challenge.

Mike

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




Last Updated on July 5, 2014


© 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