Can Prior SMA Crossover Price Levels be Stored? - NinjaTrader | futures io social day trading
futures io futures trading


Can Prior SMA Crossover Price Levels be Stored?
Updated: Views / Replies:676 / 3
Created: by Piptick 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
 

Can Prior SMA Crossover Price Levels be Stored?

  #1 (permalink)
Elite Member
Brooklyn, NY USA
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: Forex EUR/USD
 
Posts: 12 since Mar 2012
Thanks: 1 given, 0 received

Can Prior SMA Crossover Price Levels be Stored?

Hello all,

I was thinking about trying my hand at Ninjascript programming to do a simple setups. I wanted to know if there's a way for Ninjatrader to store the particular price level of an SMA associated with an SMA crossover for comparison to a prior identical crossovers that occurred earlier.
For instance, if a 6-period SMA crosses above the 18-period SMA at the close of the current bar Ninjascript (as per instructions) would record the closing price level of the 18-period SMA the crossover occurred on... but the Ninjascript would also have recorded the 18-period SMA price level that occurred on an identical 6/18-period SMA crossover that occurred prior to the current one.
The two 18-period SMA price levels would then be compared to see which is lesser/greater to check for possible momentum.

Would that price level be considered a variable?
Is this possible?
I'm definitely not a programmer, so I ask that the response be in layman's terms.

Thanks in advance for any help provided.

Reply With Quote
 
  #2 (permalink)
Elite Member
las vegas
 
Futures Experience: Intermediate
Platform: Sierra Chart
Broker/Data: Velocity/IB
Favorite Futures: 6E
 
Posts: 1,147 since Feb 2010
Thanks: 304 given, 836 received

Maybe try something like,

int crossup = SMA(6)[0] > SMA(18)[0] && SMA(6)[1] < SMA(18)[1] ? 1 : 0;
int crossdown = SMA(6)[0] < SMA(18)[0] && SMA(6)[1] > SMA(18)[1] ? 1 : 0;

Cross1[0] = crossup ==1 || crossdown ==1 ? SMA(18)[0] : Cross1[1];
Cross2[0] = crossup ==1 || crossdown ==1 ? Cross1[1] : Cross2[1];
etc.

Will need to define Cross1 and Cross2 as dataseries.

Reply With Quote
The following user says Thank You to vegasfoster for this post:
 
  #3 (permalink)
Elite Member
Brooklyn, NY USA
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: Forex EUR/USD
 
Posts: 12 since Mar 2012
Thanks: 1 given, 0 received


Thanks for your response vegasfoster.

"Maybe try something like,

int crossup = SMA(6)[0] > SMA(18)[0] && SMA(6)[1] < SMA(18)[1] ? 1 : 0;
int crossdown = SMA(6)[0] < SMA(18)[0] && SMA(6)[1] > SMA(18)[1] ? 1 : 0;

Cross1[0] = crossup ==1 || crossdown ==1 ? SMA(18)[0] : Cross1[1];
Cross2[0] = crossup ==1 || crossdown ==1 ? Cross1[1] : Cross2[1];
etc.

Will need to define Cross1 and Cross2 as dataseries.
"

I'm new to Ninjascript programming. I'm not familiar with the "? 1 : 0;" part of the statement. It seems it's referencing a previous and current SMA crossover occurrence. Please correct me if I'm wrong.
The "? SMA(18)[0] : Cross1[1];" and "? Cross1[1] : Cross2[1];" part of the statements I'm not familiar with. Could you give me a brief walk through of the logic?

Reply With Quote
 
  #4 (permalink)
Elite Member
Brooklyn, NY USA
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: Forex EUR/USD
 
Posts: 12 since Mar 2012
Thanks: 1 given, 0 received

vegasfoster,

I think I may understand the logic. I figure the best way to understand this is to do as much on my own as possible, so I did some brainstorming. Please, at your convenience, let me know if my understanding of the logic is correct.

int crossup = SMA(6)[0] > SMA(18)[0] && SMA(6)[1] < SMA(18)[1] ? 1 : 0;
int crossdown = SMA(6)[0] < SMA(18)[0] && SMA(6)[1] > SMA(18)[1] ? 1 : 0;

Logic: If statement is true value = "1", otherwise it's "0"

Cross1[0] = crossup ==1 || crossdown ==1 ? SMA(18)[0] : Cross1[1];
Logic: whether there's an SMA(18) crossover up or down, value will = SMA(18)[0] price level
which is stored as the 2nd and current SMA crossover price level (Cross1[0])...
... otherwise if the crossover SMA(18) value is not current (1 bar or more ago), it
will be stored as "Cross1[1]", the most recent and last SMA(18) crossover price level.


Cross2[0] = crossup ==1 || crossdown ==1 ? Cross1[1] : Cross2[1];
Logic: whether there's an SMA XO up or down, if a fresh current SMA(18) crossover took place
"Cross1[1]" then becomes the prior SMA(18) crossover price level and
"Cross1[0]" then becomes the current SMA(18) crossover price level
... otherwise when SMA(18) crossover is 1 bar old or more,
"Cross2[1]" becomes the stored prior SMA(18) crossover price level and
"Cross1[1]" becomes the most recent and last SMA(18) crossover price level.


Last edited by Piptick; April 23rd, 2013 at 10:47 PM.
Reply With Quote

Reply



futures io > > > > Can Prior SMA Crossover Price Levels be Stored?

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
need custom filter to search for round price levels maxim123us ThinkOrSwim Programming 3 May 22nd, 2013 04:38 PM
Prior Day Settlement Price Line Rui S NinjaTrader Programming 3 July 13th, 2012 06:28 PM
Sma typical price pullback touch plot misalto The Elite Circle 7 January 8th, 2012 01:31 AM
SMA Crossover wbtrader NinjaTrader 4 September 14th, 2011 09:38 AM
Can someone tell me where the sounds files are stored in the soumi71 NinjaTrader 6 March 17th, 2010 05:35 PM


All times are GMT -4. The time now is 01:23 PM.

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-11 in 0.19 seconds with 19 queries on phoenix via your IP 54.145.16.43