NexusFi: Find Your Edge


Home Menu

 





Stochastics coding help needed!


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one Saroj with 10 posts (1 thanks)
    2. looks_two RodS with 8 posts (0 thanks)
    3. looks_3 zt379 with 5 posts (0 thanks)
    4. looks_4 roonius with 4 posts (7 thanks)
      Best Posters
    1. looks_one Alan with 2 thanks per post
    2. looks_two roonius with 1.8 thanks per post
    3. looks_3 wh with 1 thanks per post
    4. looks_4 Saroj with 0.1 thanks per post
    1. trending_up 14,272 views
    2. thumb_up 12 thanks given
    3. group 4 followers
    1. forum 33 posts
    2. attach_file 10 attachments




 
Search this Thread

Stochastics coding help needed!

  #1 (permalink)
 
RodS's Avatar
 RodS 
Indy
 
Experience: Beginner
Platform: NinjaTrader
Broker: Mirus/Zen-Fire
Trading: 6E,TF,YM,NQ
Posts: 89 since Jun 2009
Thanks Given: 435
Thanks Received: 66

Hi All!!

I need some help from the programing guru's on the forum.....as I have none :sos:.

Max-td kindly contributed the attached stoch_alert.zip file that he had. This was post #21 from Trading CL (Crude Oil Futures). I was wanting to make a couple of changes to it.

I was wanting to have the background color change to green when the K% line rises above the 30 line and to stay green until the K% drops below the 70 line in which it turns red.

I did want to keep the audio alerts in!

Thanks in advance for any help!

Rod

Attached Thumbnails
Click image for larger version

Name:	ZN Stoch.jpg
Views:	433
Size:	101.1 KB
ID:	1424  
Attached Files
Elite Membership required to download: Stoch_Alerts.zip
Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
REcommedations for programming help
Sierra Chart
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
What broker to use for trading palladium futures
Commodities
MC PL editor upgrade
MultiCharts
Better Renko Gaps
The Elite Circle
 
  #2 (permalink)
 
Saroj's Avatar
 Saroj 
Arcata, CA
 
Experience: Intermediate
Platform: NinjaTrader
Trading: index futures, oil
Posts: 485 since Jun 2009
Thanks Given: 232
Thanks Received: 415

the zip file you attached contains a bunch of indicators: 7 standard NT indicators plus Stoch_D_Color_Alert.cs and Stoch_K_Color_Alert.cs.

just to clarify... I assume you are concerned about the latter... right now the Stoch_K_Color_Alert.cs indicator paints the background in panel 2 (or wherever you designate) green when the %K goes above OBValue and orange when it goes below OSValue;

You want to have the background be green when %K rises above the OSValue and stay green until it drops down below the OBValue when it will turn red and vice versa so basically the background is always either green or red.

What if %K falls before it reaches the OBValue or turns up before it reaches the OSValue?

What if %K never reaches the OBValue... it will stay green until it crosses down through OSValue... even though that could be a lateral consolidation... is that what you want?

I think you need to specify all the various conditions to be sure of what you really want to see on the chart. Make a truth table so that your conditions are totally clear to you... then perhaps someone can do the coding for you.

Personally, I'd suggest you considerthe following:
- green when %K is above OBValue no matter whether rising or falling
- green when %K is above 50 and rising
- orange when %K is below OSValue no matter whether rising or falling
- orange when %K is below 50 and falling
- normal chart background otherwise

I would discourage you from using red as a background color unless you change rising/falling to white/black because the red line would disappear.

As far as using 70/30 instead of 80/20... that is already a setting in Stoch_K_Color_Alert.cs

Reply With Quote
  #3 (permalink)
 
Alan's Avatar
 Alan 
Sydney - Australia
 
Experience: Intermediate
Platform: Ninja Trader
Broker: Velocity Futures
Trading: ES, 6E
Posts: 153 since Jun 2009
Thanks Given: 1,442
Thanks Received: 144


Hi RodS,

I think that this is what you are after. It's from the Ninja Site:

Dinapoli Stochastic - Page 2 - [AUTOLINK]NinjaTrader[/AUTOLINK] Support Forum

I have used this many times and I think that it works really well. Give it a go and see is this does what you are after.

Reply With Quote
Thanked by:
  #4 (permalink)
 
wh's Avatar
 wh 
Neubrandenburg, Germany
 
Experience: Advanced
Platform: R
Trading: Stocks
Posts: 538 since Jun 2009
Thanks Given: 298
Thanks Received: 512

here is from nt forum https://ninjatrader.com/support/forum/local_links.php?catid=1&sort=N&pp=15&page=4

Attached Files
Elite Membership required to download: DinapoliStochastic.zip
Reply With Quote
Thanked by:
  #5 (permalink)
 
Saroj's Avatar
 Saroj 
Arcata, CA
 
Experience: Intermediate
Platform: NinjaTrader
Trading: index futures, oil
Posts: 485 since Jun 2009
Thanks Given: 232
Thanks Received: 415

Stoch_K_Color_Alerts_sg




Added functionality:
  1. Select level for coloring %K when between OSValue and OBValue depending on whether rising or falling
  2. Select the background colors for %K conditions
  3. Sound Alert On/Off Toggle
RodS, I have not tested the sound alerts although I added an On/Off toggle; also, this may not be exactly what you were thinking of but it is close... you need to think through the stochastic movement conditions that I mentioned in my earlier post. Enjoy!

By the way, the image shows a yellow trigger Stochastic (1,3,3) that I use for entering after a pullback.

To import this, save the zip file to your file system, then from the Control Center do: File / Utilities / Import NinjaScript; select the file you saved; select "Yes" for trusted; then when you see the "... already exists...", select "No" for replacing duplicates (they are standard NT indicators).

Attached Thumbnails
Click image for larger version

Name:	StochKColorAlert-RodS.png
Views:	370
Size:	36.3 KB
ID:	1445  
Attached Files
Elite Membership required to download: _Stoch_K_Color_Alert_sg.cs
Elite Membership required to download: StochKColorAlertforRodS.zip
Reply With Quote
Thanked by:
  #6 (permalink)
 
jdella's Avatar
 jdella 
Concord, NH USA
 
Experience: Intermediate
Platform: Ninja trader
Broker: AMP/CQG
Trading: ES
Posts: 182 since Jun 2009
Thanks Given: 140
Thanks Received: 115

I am amazed at how fast some of you guys can code something. I'm so envious. I have no knowledge of your world at all and even though this isn't my thread, my hats off to all you who are computer language literate.

Jeff

Reply With Quote
Thanked by:
  #7 (permalink)
 
Saroj's Avatar
 Saroj 
Arcata, CA
 
Experience: Intermediate
Platform: NinjaTrader
Trading: index futures, oil
Posts: 485 since Jun 2009
Thanks Given: 232
Thanks Received: 415

Stumbling along, Jeff... although my career started out programming decades ago... it ended 9 years ago as a business process redesign consultant... I swore I wouldn't get back to programming, but the possibilities sucked me back in... get by using others code and modifying it. Check out some of the links in the "Sticky" section... there are quite a few members who have no professional programming experience who are doing great work.

Reply With Quote
  #8 (permalink)
 
Saroj's Avatar
 Saroj 
Arcata, CA
 
Experience: Intermediate
Platform: NinjaTrader
Trading: index futures, oil
Posts: 485 since Jun 2009
Thanks Given: 232
Thanks Received: 415



The Dinapoli stochastic indicator colors based on %K / %D crosses using the Dinapoli formulae rather than standard stochastic formulae... while it is possible that is what RodS wants, it isn't what he requested.

Reply With Quote
  #9 (permalink)
 
RodS's Avatar
 RodS 
Indy
 
Experience: Beginner
Platform: NinjaTrader
Broker: Mirus/Zen-Fire
Trading: 6E,TF,YM,NQ
Posts: 89 since Jun 2009
Thanks Given: 435
Thanks Received: 66

Hi Saroj,


Sorry for the late response. I have been having major connection problems with my service provider today!!! Hopefully it's fixed.

First off thanks for your help in this. i haven't checked what you have coded for me but at first glimpse it looks good. I have attached a new chark that should show better what i am looking for.

I actually combined the Dinapoli Stochastic and Stoch_K_Color_Alert to form panel 2. This is pretty much what I was looking for.

The current alerts are triggered for when K% is rising and crosses from below OBValue line and when K% is falling and crosses from above OSValue line.

Where I want my signal is when K% is above the OBValue line (70 -100) and drops below 70, or user defined value, I want a short .wav signal.

And when K% is below the OSValue line (0-30) and rises above 30,or user defined, I want a long.wav signal.

I am not using these as entries. I am using these as heads up to be used with other indicators and price action for a possible entry.

Thanks also to Alan and wh for the dinapoli stochastic link!

Thanks

Rod

Attached Thumbnails
Click image for larger version

Name:	ZN 09-09  8_27_2009 (4 Range)combined.jpg
Views:	376
Size:	120.6 KB
ID:	1451  
Started this thread Reply With Quote
  #10 (permalink)
 
Saroj's Avatar
 Saroj 
Arcata, CA
 
Experience: Intermediate
Platform: NinjaTrader
Trading: index futures, oil
Posts: 485 since Jun 2009
Thanks Given: 232
Thanks Received: 415


your chart looks good... and that consolidation area is nicely colored... would you mind posting your template? I'd like to see how you combined the two... keep in mind that the Dinapoli is a %K/%D cross... nothing to do with levels as far as I could see... correct me if I'm wrong.

As far as I understand your description, my modifications should do what you want... but you haven't said what should happen under all conditions.

Reply With Quote




Last Updated on October 24, 2009


© 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