Need little help with a Ninjatrader script - NinjaTrader Programming | futures io social day trading
futures io futures trading


Need little help with a Ninjatrader script
Updated: Views / Replies:1,971 / 9
Created: by raindrop 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
 

Need little help with a Ninjatrader script

  #1 (permalink)
Elite Member
USA
 
Futures Experience: Beginner
Platform: NinjaTrader 6.5
 
Posts: 18 since Mar 2010
Thanks: 13 given, 1 received

Need little help with a Ninjatrader script

Hi All,
I need to code few simple lines but not sure how to do it. I'd appreciate any help.

1) RSI(14) has been above 80 anytime within last 12 bars.

2) And price is at least 20 pips above the SMA(25)

Thanks.

Reply With Quote
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

 
  #3 (permalink)
Elite Member
Frankfurt
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: FGBL 6E B4
 
max-td's Avatar
 
Posts: 1,754 since Jun 2009
Thanks: 2,309 given, 917 received


hi raindrop,

i think a little more explaination of what you like to have is needed for helpers.
do you work on an indicator or strategy ?
do you want to plot anything ?
do you only want to have the conditions to be written in code ?

thanks
max

max-td
Reply With Quote
 
  #4 (permalink)
Elite Member
Calcutta, India
 
Futures Experience: Intermediate
Platform: ArthaChitra
 
Posts: 278 since Jun 2009
Thanks: 161 given, 259 received


raindrop View Post
Hi All,
I need to code few simple lines but not sure how to do it. I'd appreciate any help.

1) RSI(14) has been above 80 anytime within last 12 bars.

2) And price is at least 20 pips above the SMA(25)

Thanks.

dont know if this is the most elegant way to do, but you can try something like below

put the code in OnBarUpdate
 
Code
bool istrue = false;
            
 for (int i = 0;i<= 11; i++)
 {
           if (RSI(Close,14,3)[i] > 80)
          {
                    istrue = true;
                    break;
           }
 }

if (istrue && Close[0] - TickSize * 20 > SMA(25)[0])
{
   //do your stuff

}

Reply With Quote
The following 4 users say Thank You to bukkan for this post:
 
  #5 (permalink)
Elite Member
Asia
 
Futures Experience: Beginner
Platform: NinjaTrader, TOS
 
Posts: 798 since Jun 2009
Thanks: 109 given, 786 received

You can also look at MostRecentOccurance()/LeastRecentOccurance() for the RSI part of the logic.

Reply With Quote
The following 5 users say Thank You to MXASJ for this post:
 
  #6 (permalink)
Elite Member
Calcutta, India
 
Futures Experience: Intermediate
Platform: ArthaChitra
 
Posts: 278 since Jun 2009
Thanks: 161 given, 259 received


MXASJ View Post
You can also look at MostRecentOccurance()/LeastRecentOccurance() for the RSI part of the logic.

thanks MXASJ, thats the way to go.

Reply With Quote
The following 2 users say Thank You to bukkan for this post:
 
  #7 (permalink)
Elite Member
Frankfurt
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: FGBL 6E B4
 
max-td's Avatar
 
Posts: 1,754 since Jun 2009
Thanks: 2,309 given, 917 received

what you guys think about the count If - code for the RSI - check ?

// If in the last 10 bars we have had 8 up bars then go long

if ( CountIf(delegate {return Close[0] > Open[0];}, 10) > 8)

.... do things

max-td
Reply With Quote
The following 2 users say Thank You to max-td for this post:
 
  #8 (permalink)
Elite Member
Denver, CO
 
Futures Experience: Advanced
Platform: NinjaTrader
Broker/Data: NinjaTrader Brokerage
Favorite Futures: ES
 
NinjaTrader's Avatar
 
Posts: 1,260 since May 2010
Thanks: 153 given, 1,890 received

Unless I am missing something...

if (MAX(RSI(14), 12)[0] > 80 && Close[0] > SMA(25)[0] + 20 * TickSize)
// Do something

Reply With Quote
The following 2 users say Thank You to NinjaTrader for this post:
 
  #9 (permalink)
Elite Member
Calcutta, India
 
Futures Experience: Intermediate
Platform: ArthaChitra
 
Posts: 278 since Jun 2009
Thanks: 161 given, 259 received

boy o boy now whos the fairest of all

my code (post 4) and the one posted by Ray using the MAX function are essentially the same. my code breaks from the loop once the condition is fulfilled (i.e. RSI > 80) while MAX loops to the end and find the highest value. So that way max is doing some extra loop which is redundant in our case.

what is the code behind MRO as MXASJ pointed out?

Reply With Quote
 
  #10 (permalink)
Elite Member
USA
 
Futures Experience: Beginner
Platform: NinjaTrader 6.5
 
Posts: 18 since Mar 2010
Thanks: 13 given, 1 received


I came back to see if there is any response to my question and was amazed to see the level of help here. I really appreciate everyone trying to help me here.

I am trying to write a trend trading strategy script so that's why I want to look back few periods. I do not have to plot the RSI on the chart but it would be a plus if I could. I can write simple scripts on Stockfetcher but that is the limit of my coding abilities
.

Now while testing my strategy I have noticed that price is more likely to whipsaw when it is very close to lets say SMA(25) and I want the strategy to only generate a signal if price is at least 25 pips away (above or below depending upon the direction of the trade) from SMA(25). What would you experts think such a script look like?


Again I appreciate all the help extended to me in this thread.


Raindrop.

Reply With Quote

Reply



futures io > > > > > Need little help with a Ninjatrader script

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
Easy Language to Ninja Script fireman912 NinjaTrader Programming 4 June 23rd, 2011 11:39 PM
Looking for this script or indicator. rh017548 NinjaTrader Programming 3 May 16th, 2010 08:00 PM
How do I write the script for kaywai NinjaTrader Programming 1 January 19th, 2010 11:06 AM
script idea sharky NinjaTrader Programming 64 November 15th, 2009 06:05 PM


All times are GMT -4. The time now is 08:28 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-12 in 0.13 seconds with 19 queries on phoenix via your IP 54.90.207.75